xref: /openbmc/phosphor-dbus-monitor/src/test/conditiongentest.cpp (revision 07c35131cb7dca8f0c939417ca8eb379b0ea04c4)
13d6d3182SPatrick Venture #include "data_types.hpp"
23d6d3182SPatrick Venture 
3b97bfff7SBrad Bishop #include <array>
4b97bfff7SBrad Bishop #include <string>
53d6d3182SPatrick Venture 
6b97bfff7SBrad Bishop #include <gtest/gtest.h>
7b97bfff7SBrad Bishop 
8b97bfff7SBrad Bishop using namespace phosphor::dbus::monitoring;
9b97bfff7SBrad Bishop 
10b97bfff7SBrad Bishop #include "conditiongentest.hpp"
11b97bfff7SBrad Bishop 
12d1eac88dSBrad Bishop const std::array<std::vector<size_t>, 2> expectedGroups = {{
13b97bfff7SBrad Bishop     {0},
14b97bfff7SBrad Bishop     {1},
15d1eac88dSBrad Bishop }};
16b97bfff7SBrad Bishop 
17*07c35131SMatthew Barth const std::array<size_t, 6> expectedCallbacks = {
18*07c35131SMatthew Barth     0, 0, 1, 1, 0, 1,
19b97bfff7SBrad Bishop };
20b97bfff7SBrad Bishop 
TEST(ConditionGenTest,GroupsSameSize)21b97bfff7SBrad Bishop TEST(ConditionGenTest, GroupsSameSize)
22b97bfff7SBrad Bishop {
23b97bfff7SBrad Bishop     ASSERT_EQ(sizeof(expectedGroups), sizeof(groups));
24b97bfff7SBrad Bishop }
25b97bfff7SBrad Bishop 
TEST(ConditionGenTest,CallbacksSameSize)26b97bfff7SBrad Bishop TEST(ConditionGenTest, CallbacksSameSize)
27b97bfff7SBrad Bishop {
28bd31f39eSMatthew Barth     ASSERT_EQ(sizeof(expectedCallbacks), sizeof(callbacks));
29b97bfff7SBrad Bishop }
30b97bfff7SBrad Bishop 
TEST(ConditionGenTest,GroupsSameContent)31b97bfff7SBrad Bishop TEST(ConditionGenTest, GroupsSameContent)
32b97bfff7SBrad Bishop {
33b97bfff7SBrad Bishop     size_t i;
34b97bfff7SBrad Bishop     for (i = 0; i < expectedGroups.size(); ++i)
35b97bfff7SBrad Bishop     {
36d1eac88dSBrad Bishop         ASSERT_EQ(groups[i], expectedGroups[i]);
37b97bfff7SBrad Bishop     }
38b97bfff7SBrad Bishop }
39b97bfff7SBrad Bishop 
TEST(ConditionGenTest,CallbacksSameContent)40b97bfff7SBrad Bishop TEST(ConditionGenTest, CallbacksSameContent)
41b97bfff7SBrad Bishop {
42b97bfff7SBrad Bishop     size_t i;
43b97bfff7SBrad Bishop     for (i = 0; i < expectedCallbacks.size(); ++i)
44b97bfff7SBrad Bishop     {
45d1eac88dSBrad Bishop         ASSERT_EQ(callbacks[i], expectedCallbacks[i]);
46b97bfff7SBrad Bishop     }
47b97bfff7SBrad Bishop }
48