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 | |
| 10 | const std::array<std::vector<size_t>, 2> expectedGroups = |
| 11 | { |
| 12 | { |
| 13 | {0}, |
| 14 | {1}, |
| 15 | } |
| 16 | }; |
| 17 | |
| 18 | const std::array<size_t, 4> expectedCallbacks = |
| 19 | { |
| 20 | 0, |
| 21 | 0, |
| 22 | 1, |
| 23 | 1, |
| 24 | }; |
| 25 | |
| 26 | TEST(ConditionGenTest, GroupsSameSize) |
| 27 | { |
| 28 | ASSERT_EQ(sizeof(expectedGroups), sizeof(groups)); |
| 29 | } |
| 30 | |
| 31 | TEST(ConditionGenTest, CallbacksSameSize) |
| 32 | { |
| 33 | ASSERT_EQ(sizeof(expectedGroups), sizeof(groups)); |
| 34 | } |
| 35 | |
| 36 | TEST(ConditionGenTest, GroupsSameContent) |
| 37 | { |
| 38 | size_t i; |
| 39 | for (i = 0; i < expectedGroups.size(); ++i) |
| 40 | { |
| 41 | ASSERT_EQ(groups[i], |
| 42 | expectedGroups[i]); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | TEST(ConditionGenTest, CallbacksSameContent) |
| 47 | { |
| 48 | size_t i; |
| 49 | for (i = 0; i < expectedCallbacks.size(); ++i) |
| 50 | { |
| 51 | ASSERT_EQ(callbacks[i], |
| 52 | expectedCallbacks[i]); |
| 53 | } |
| 54 | } |