diff options
| author | William A. Kennington III <wak@google.com> | 2018-06-23 00:33:08 -0700 |
|---|---|---|
| committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-07-09 18:20:42 +0000 |
| commit | 977d4d48aaf85730c99238da649b5488fd1b02dd (patch) | |
| tree | c4ea8fd6dce2a016196df9e0b11082da18d5b91c | |
| parent | a4446c77faaf6b39b6b6265ae324630be8d9741c (diff) | |
| download | sdbusplus-977d4d48aaf85730c99238da649b5488fd1b02dd.tar.gz sdbusplus-977d4d48aaf85730c99238da649b5488fd1b02dd.zip | |
test/type_traits: Convert to gtest
This is a fairly minimal and non-invasive change. This test doesn't
really require the googletest framework since it is just using
static_asserts. However, this moves us toward uniform testing.
Change-Id: I35d507cf6c97384146120d4f8f1b5a2e52834a6d
Signed-off-by: William A. Kennington III <wak@google.com>
| -rw-r--r-- | test/Makefile.am | 3 | ||||
| -rw-r--r-- | test/utility/type_traits.cpp | 26 |
2 files changed, 17 insertions, 12 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 442d084..b7b6a03 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -52,8 +52,7 @@ utility_tuple_to_array_LDADD = $(gtest_ldadd) check_PROGRAMS += utility_type_traits utility_type_traits_SOURCES = utility/type_traits.cpp -utility_type_traits_CXXFLAGS = $(legacy_test_cxxflags) -utility_type_traits_LDADD = $(legacy_test_ldadd) +utility_type_traits_LDADD = $(gtest_ldadd) check_PROGRAMS += vtable_vtable vtable_vtable_SOURCES = vtable/vtable.cpp vtable/vtable_c.c diff --git a/test/utility/type_traits.cpp b/test/utility/type_traits.cpp index f2beed7..1a411f7 100644 --- a/test/utility/type_traits.cpp +++ b/test/utility/type_traits.cpp @@ -1,21 +1,27 @@ +#include <gtest/gtest.h> #include <sdbusplus/utility/type_traits.hpp> +#include <type_traits> -int main() +namespace { - using sdbusplus::utility::array_to_ptr_t; - static_assert(std::is_same<char, array_to_ptr_t<char, char>>::value, +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(std::is_same<char*, array_to_ptr_t<char, char*>>::value, + static_assert(is_same<char*, array_to_ptr_t<char, char*>>::value, "array_to_ptr_t<char, char*> != char*"); - static_assert(std::is_same<char*, array_to_ptr_t<char, char[100]>>::value, + static_assert(is_same<char*, array_to_ptr_t<char, char[100]>>::value, "array_to_ptr_t<char, char[100]> != char*"); - static_assert( - std::is_same<char[100], array_to_ptr_t<int, char[100]>>::value, - "array_to_ptr_t<int, char[100]> != char[100]"); - - return 0; + static_assert(is_same<char[100], array_to_ptr_t<int, char[100]>>::value, + "array_to_ptr_t<int, char[100]> != char[100]"); } + +} // namespace |

