blob: 0b7917009663404bfe46cfcd575f2340dda890cb [file] [log] [blame]
Patrick Williams4dbdef72016-07-20 12:36:56 -05001#include <sdbusplus/utility/tuple_to_array.hpp>
Patrick Venture95269db2018-08-31 09:19:17 -07002
Patrick Williams608b5bc2017-04-28 16:00:19 -05003#include <gtest/gtest.h>
Patrick Williams4dbdef72016-07-20 12:36:56 -05004
Patrick Williams608b5bc2017-04-28 16:00:19 -05005TEST(TupleToArray, Test3Chars)
Patrick Williams4dbdef72016-07-20 12:36:56 -05006{
7 std::array<char, 3> a{'a', 'b', 'c'};
8 auto t = std::make_tuple('a', 'b', 'c');
9
Patrick Williams608b5bc2017-04-28 16:00:19 -050010 ASSERT_EQ(a, sdbusplus::utility::tuple_to_array(std::move(t)));
11}
Patrick Williams4dbdef72016-07-20 12:36:56 -050012
Patrick Williams608b5bc2017-04-28 16:00:19 -050013TEST(TupleToArray, Test4Ints)
14{
Patrick Williams4dbdef72016-07-20 12:36:56 -050015 std::array<int, 4> b{1, 2, 3, 4};
16 auto t2 = std::make_tuple(1, 2, 3, 4);
17
Patrick Williams608b5bc2017-04-28 16:00:19 -050018 ASSERT_EQ(b, sdbusplus::utility::tuple_to_array(std::move(t2)));
Patrick Williams4dbdef72016-07-20 12:36:56 -050019}