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 | |
Matthew Barth | 07c3513 | 2019-10-21 10:02:33 -0500 | [diff] [blame] | 17 | const std::array<size_t, 6> expectedCallbacks = { |
| 18 | 0, 0, 1, 1, 0, 1, |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 19 | }; |
| 20 | |
| 21 | TEST(ConditionGenTest, GroupsSameSize) |
| 22 | { |
| 23 | ASSERT_EQ(sizeof(expectedGroups), sizeof(groups)); |
| 24 | } |
| 25 | |
| 26 | TEST(ConditionGenTest, CallbacksSameSize) |
| 27 | { |
Matthew Barth | bd31f39 | 2019-10-21 09:57:22 -0500 | [diff] [blame] | 28 | ASSERT_EQ(sizeof(expectedCallbacks), sizeof(callbacks)); |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | TEST(ConditionGenTest, GroupsSameContent) |
| 32 | { |
| 33 | size_t i; |
| 34 | for (i = 0; i < expectedGroups.size(); ++i) |
| 35 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 36 | ASSERT_EQ(groups[i], expectedGroups[i]); |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 37 | } |
| 38 | } |
| 39 | |
| 40 | TEST(ConditionGenTest, CallbacksSameContent) |
| 41 | { |
| 42 | size_t i; |
| 43 | for (i = 0; i < expectedCallbacks.size(); ++i) |
| 44 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 45 | ASSERT_EQ(callbacks[i], expectedCallbacks[i]); |
Brad Bishop | b97bfff | 2017-05-25 22:14:54 -0400 | [diff] [blame] | 46 | } |
| 47 | } |