Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 1 | #include <sdbusplus/utility/tuple_to_array.hpp> |
Patrick Williams | 608b5bc | 2017-04-28 16:00:19 -0500 | [diff] [blame] | 2 | #include <gtest/gtest.h> |
Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 3 | |
Patrick Williams | 608b5bc | 2017-04-28 16:00:19 -0500 | [diff] [blame] | 4 | TEST(TupleToArray, Test3Chars) |
Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 5 | { |
| 6 | std::array<char, 3> a{'a', 'b', 'c'}; |
| 7 | auto t = std::make_tuple('a', 'b', 'c'); |
| 8 | |
Patrick Williams | 608b5bc | 2017-04-28 16:00:19 -0500 | [diff] [blame] | 9 | ASSERT_EQ(a, sdbusplus::utility::tuple_to_array(std::move(t))); |
| 10 | } |
Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 11 | |
Patrick Williams | 608b5bc | 2017-04-28 16:00:19 -0500 | [diff] [blame] | 12 | TEST(TupleToArray, Test4Ints) |
| 13 | { |
Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 14 | std::array<int, 4> b{1, 2, 3, 4}; |
| 15 | auto t2 = std::make_tuple(1, 2, 3, 4); |
| 16 | |
Patrick Williams | 608b5bc | 2017-04-28 16:00:19 -0500 | [diff] [blame] | 17 | ASSERT_EQ(b, sdbusplus::utility::tuple_to_array(std::move(t2))); |
Patrick Williams | 4dbdef7 | 2016-07-20 12:36:56 -0500 | [diff] [blame] | 18 | } |