Patrick Venture | 21be45a | 2018-11-06 12:08:52 -0800 | [diff] [blame] | 1 | #include "firmware_handler.hpp" |
| 2 | |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame^] | 3 | #include <algorithm> |
Patrick Venture | 21be45a | 2018-11-06 12:08:52 -0800 | [diff] [blame] | 4 | #include <memory> |
| 5 | |
| 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | namespace blobs |
| 9 | { |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame^] | 10 | |
| 11 | TEST(FirmwareHandlerTest, CreateEmptyListVerifyFails) |
Patrick Venture | 21be45a | 2018-11-06 12:08:52 -0800 | [diff] [blame] | 12 | { |
| 13 | auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({}, 0); |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame^] | 14 | EXPECT_EQ(handler, nullptr); |
| 15 | } |
| 16 | TEST(FirmwareHandlerTest, CreateEmptyListVerifyHasHash) |
| 17 | { |
| 18 | auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({"asdf"}, 0); |
Patrick Venture | 21be45a | 2018-11-06 12:08:52 -0800 | [diff] [blame] | 19 | auto result = handler->getBlobIds(); |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame^] | 20 | 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 Venture | 21be45a | 2018-11-06 12:08:52 -0800 | [diff] [blame] | 24 | } |
| 25 | } // namespace blobs |