Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 1 | #include <array> |
| 2 | #include <string> |
| 3 | #include <gtest/gtest.h> |
| 4 | #include "data_types.hpp" |
| 5 | |
| 6 | using namespace phosphor::dbus::monitoring; |
| 7 | |
| 8 | #include "conditiongentest.hpp" |
| 9 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 10 | const std::array<std::vector<size_t>, 2> expectedGroups = {{ |
| 11 | {0}, |
| 12 | {1}, |
| 13 | }}; |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 14 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 15 | const std::array<size_t, 4> expectedCallbacks = { |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 16 | 0, |
| 17 | 0, |
| 18 | 1, |
| 19 | 1, |
| 20 | }; |
| 21 | |
| 22 | TEST(ConditionGenTest, GroupsSameSize) |
| 23 | { |
| 24 | ASSERT_EQ(sizeof(expectedGroups), sizeof(groups)); |
| 25 | } |
| 26 | |
| 27 | TEST(ConditionGenTest, CallbacksSameSize) |
| 28 | { |
| 29 | ASSERT_EQ(sizeof(expectedGroups), sizeof(groups)); |
| 30 | } |
| 31 | |
| 32 | TEST(ConditionGenTest, GroupsSameContent) |
| 33 | { |
| 34 | size_t i; |
| 35 | for (i = 0; i < expectedGroups.size(); ++i) |
| 36 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 37 | ASSERT_EQ(groups[i], expectedGroups[i]); |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | |
| 41 | TEST(ConditionGenTest, CallbacksSameContent) |
| 42 | { |
| 43 | size_t i; |
| 44 | for (i = 0; i < expectedCallbacks.size(); ++i) |
| 45 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 46 | ASSERT_EQ(callbacks[i], expectedCallbacks[i]); |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 47 | } |
| 48 | } |