Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 1 | #include <sdbusplus/vtable.hpp> |
Patrick Venture | 95269db | 2018-08-31 09:19:17 -0700 | [diff] [blame] | 2 | |
Patrick Williams | a14167b | 2017-04-28 15:54:39 -0500 | [diff] [blame] | 3 | #include <gtest/gtest.h> |
Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 4 | |
Andrew Geissler | 072da3e | 2018-01-18 07:21:42 -0800 | [diff] [blame] | 5 | static const sdbusplus::vtable::vtable_t example[] = { |
| 6 | sdbusplus::vtable::start(), |
| 7 | sdbusplus::vtable::method((const char*)1, (const char*)2, (const char*)3, |
| 8 | (sd_bus_message_handler_t)4), |
| 9 | sdbusplus::vtable::signal((const char*)5, (const char*)6), |
| 10 | sdbusplus::vtable::property((const char*)7, (const char*)8, |
| 11 | (sd_bus_property_get_t)9, |
| 12 | sdbusplus::vtable::property_::const_), |
| 13 | sdbusplus::vtable::property((const char*)10, (const char*)11, |
| 14 | (sd_bus_property_get_t)12, |
| 15 | (sd_bus_property_set_t)13), |
| 16 | sdbusplus::vtable::property_o((const char*)14, (const char*)15, 16), |
| 17 | sdbusplus::vtable::end()}; |
Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 18 | |
| 19 | extern const sd_bus_vtable example2[]; |
| 20 | extern const size_t example2_size; |
| 21 | |
Patrick Williams | a14167b | 2017-04-28 15:54:39 -0500 | [diff] [blame] | 22 | TEST(VtableTest, SameSize) |
Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 23 | { |
Patrick Williams | a14167b | 2017-04-28 15:54:39 -0500 | [diff] [blame] | 24 | ASSERT_EQ(sizeof(example), example2_size); |
| 25 | } |
Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 26 | |
Patrick Williams | a14167b | 2017-04-28 15:54:39 -0500 | [diff] [blame] | 27 | TEST(VtableTest, SameContent) |
| 28 | { |
| 29 | ASSERT_EQ(0, memcmp(example, example2, example2_size)); |
| 30 | } |