blob: 8ef74c1b32f886241eaf57163b187a246ef692d5 [file] [log] [blame]
Patrick Venture21be45a2018-11-06 12:08:52 -08001#include "firmware_handler.hpp"
2
Patrick Venture52854622018-11-06 12:30:00 -08003#include <algorithm>
Patrick Venture21be45a2018-11-06 12:08:52 -08004#include <memory>
5
6#include <gtest/gtest.h>
7
8namespace blobs
9{
Patrick Venture52854622018-11-06 12:30:00 -080010
11TEST(FirmwareHandlerTest, CreateEmptyListVerifyFails)
Patrick Venture21be45a2018-11-06 12:08:52 -080012{
13 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({}, 0);
Patrick Venture52854622018-11-06 12:30:00 -080014 EXPECT_EQ(handler, nullptr);
15}
16TEST(FirmwareHandlerTest, CreateEmptyListVerifyHasHash)
17{
18 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({"asdf"}, 0);
Patrick Venture21be45a2018-11-06 12:08:52 -080019 auto result = handler->getBlobIds();
Patrick Venture52854622018-11-06 12:30:00 -080020 EXPECT_EQ(2, result.size());
21 EXPECT_EQ(2, std::count(result.begin(), result.end(), "asdf") +
22 std::count(result.begin(), result.end(),
23 FirmwareBlobHandler::hashBlobID));
Patrick Venture21be45a2018-11-06 12:08:52 -080024}
25} // namespace blobs