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