summaryrefslogtreecommitdiffstats
path: root/test/utility/type_traits.cpp
blob: 6e15201da33dff92971dd669c86e1fd987813e5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <sdbusplus/utility/type_traits.hpp>
#include <type_traits>

#include <gtest/gtest.h>

namespace
{

using sdbusplus::utility::array_to_ptr_t;
using std::is_same;

TEST(TypeTraits, Basic)
{

    static_assert(is_same<char, array_to_ptr_t<char, char>>::value,
                  "array_to_ptr_t<char, char> != char");

    static_assert(is_same<char*, array_to_ptr_t<char, char*>>::value,
                  "array_to_ptr_t<char, char*> != char*");

    static_assert(is_same<char*, array_to_ptr_t<char, char[100]>>::value,
                  "array_to_ptr_t<char, char[100]> != char*");

    static_assert(is_same<char[100], array_to_ptr_t<int, char[100]>>::value,
                  "array_to_ptr_t<int, char[100]> != char[100]");
}

} // namespace
OpenPOWER on IntegriCloud