Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 1 | #include "version_handler.hpp" |
William A. Kennington III | abf1735 | 2020-12-22 21:07:11 -0800 | [diff] [blame] | 2 | #include "version_mock.hpp" |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 3 | |
| 4 | #include <array> |
William A. Kennington III | abf1735 | 2020-12-22 21:07:11 -0800 | [diff] [blame] | 5 | #include <utility> |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 6 | |
| 7 | #include <gtest/gtest.h> |
| 8 | |
| 9 | namespace ipmi_flash |
| 10 | { |
| 11 | |
| 12 | TEST(VersionHandlerCanHandleTest, VerifyGoodInfoMapPasses) |
| 13 | { |
William A. Kennington III | abf1735 | 2020-12-22 21:07:11 -0800 | [diff] [blame] | 14 | constexpr std::array blobs{"blob0", "blob1"}; |
| 15 | VersionBlobHandler handler(createMockVersionConfigs(blobs)); |
| 16 | EXPECT_THAT(handler.getBlobIds(), |
| 17 | testing::UnorderedElementsAreArray(blobs)); |
| 18 | } |
| 19 | |
| 20 | TEST(VersionHandlerCanHandleTest, VerifyDuplicatesIgnored) |
| 21 | { |
| 22 | constexpr std::array blobs{"blob0"}; |
| 23 | auto configs = createMockVersionConfigs(blobs); |
| 24 | configs.push_back(createMockVersionConfig(blobs[0])); |
| 25 | VersionBlobHandler handler(std::move(configs)); |
| 26 | EXPECT_THAT(handler.getBlobIds(), |
| 27 | testing::UnorderedElementsAreArray(blobs)); |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 28 | } |
| 29 | |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 30 | } // namespace ipmi_flash |