blob: bf737834b39a74b76f5d30abd7f488442be74113 [file] [log] [blame]
Patrick Williams4dbdef72016-07-20 12:36:56 -05001#include <sdbusplus/utility/tuple_to_array.hpp>
Patrick Williams608b5bc2017-04-28 16:00:19 -05002#include <gtest/gtest.h>
Patrick Williams4dbdef72016-07-20 12:36:56 -05003
Patrick Williams608b5bc2017-04-28 16:00:19 -05004TEST(TupleToArray, Test3Chars)
Patrick Williams4dbdef72016-07-20 12:36:56 -05005{
6 std::array<char, 3> a{'a', 'b', 'c'};
7 auto t = std::make_tuple('a', 'b', 'c');
8
Patrick Williams608b5bc2017-04-28 16:00:19 -05009 ASSERT_EQ(a, sdbusplus::utility::tuple_to_array(std::move(t)));
10}
Patrick Williams4dbdef72016-07-20 12:36:56 -050011
Patrick Williams608b5bc2017-04-28 16:00:19 -050012TEST(TupleToArray, Test4Ints)
13{
Patrick Williams4dbdef72016-07-20 12:36:56 -050014 std::array<int, 4> b{1, 2, 3, 4};
15 auto t2 = std::make_tuple(1, 2, 3, 4);
16
Patrick Williams608b5bc2017-04-28 16:00:19 -050017 ASSERT_EQ(b, sdbusplus::utility::tuple_to_array(std::move(t2)));
Patrick Williams4dbdef72016-07-20 12:36:56 -050018}