diff --git a/test/test.cpp b/test/test.cpp index 25d3cbd..a277439 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -82,108 +82,6 @@ const SomeClass volatile * ptr_c = nullptr; const Color color = Color::RED; const Directions directions = Directions::Right; -TEST_CASE("constexpr") { - SECTION("NAMEOF") { - // variable - constexpr auto cx1 = NAMEOF(struct_var); - static_assert(cx1 == "struct_var"); - REQUIRE(cx1 == "struct_var"); - // member - constexpr auto cx2 = NAMEOF((&struct_var)->somefield); - static_assert(cx2 == "somefield"); - REQUIRE(cx2 == "somefield"); - // function - constexpr auto cx3 = NAMEOF(&SomeClass::SomeMethod6); - static_assert(cx3 == "SomeMethod6"); - REQUIRE(cx3 == "SomeMethod6"); - // enum - constexpr auto cx4 = NAMEOF(Color::RED); - static_assert(cx4 == "RED"); - REQUIRE(cx4 == "RED"); - } - - SECTION("NAMEOF_FULL") { - // variable - constexpr auto cx1 = NAMEOF_FULL(struct_var); - static_assert(cx1 == "struct_var"); - REQUIRE(cx1 == "struct_var"); - // member - constexpr auto cx2 = NAMEOF_FULL((&struct_var)->somefield); - static_assert(cx2 == "somefield"); - REQUIRE(cx2 == "somefield"); - // function - constexpr auto cx3 = NAMEOF_FULL(&SomeClass::SomeMethod6); - static_assert(cx3 == "SomeMethod6"); - REQUIRE(cx3 == "SomeMethod6"); - // enum - constexpr auto cx4 = NAMEOF_FULL(Color::RED); - static_assert(cx4 == "RED"); - REQUIRE(cx4 == "RED"); - } - - SECTION("NAMEOF_RAW") { - // variable - constexpr auto cx1 = NAMEOF_RAW(struct_var); - static_assert(cx1 == "struct_var"); - REQUIRE(cx1 == "struct_var"); - // member - constexpr auto cx2 = NAMEOF_RAW((&struct_var)->somefield); - static_assert(cx2 == "(&struct_var)->somefield"); - REQUIRE(cx2 == "(&struct_var)->somefield"); - // function - constexpr auto cx4 = NAMEOF_RAW(&SomeStruct::SomeMethod2); - static_assert(cx4 == "&SomeStruct::SomeMethod2"); - REQUIRE(cx4 == "&SomeStruct::SomeMethod2"); - // enum - constexpr auto cx5 = NAMEOF_RAW(Color::RED); - static_assert(cx5 == "Color::RED"); - REQUIRE(cx5 == "Color::RED"); - // macros - constexpr auto cx6 = NAMEOF_RAW(__cplusplus); - static_assert(cx6 == "__cplusplus"); - REQUIRE(cx6 == "__cplusplus"); - } - - SECTION("NAMEOF_ENUM") { - constexpr auto cx = NAMEOF_ENUM(color); -#if defined(__clang__) || defined(_MSC_VER) - static_assert(cx == "RED"); - REQUIRE(cx == "RED"); -#elif defined(__GNUC__) - static_assert(cx == "(Color)-1"); - REQUIRE(cx == "(Color)-1"); -#endif - } - - SECTION("NAMEOF_TYPE") { - constexpr auto cx = NAMEOF_TYPE(ptr_c); -#if defined(__clang__) - static_assert(cx == "const volatile SomeClass *"); - REQUIRE(cx == "const volatile SomeClass *"); -#elif defined(__GNUC__) - static_assert(cx == "const volatile SomeClass*"); - REQUIRE(cx == "const volatile SomeClass*"); -#elif defined(_MSC_VER) - static_assert(cx == "SomeClass const volatile *"); - REQUIRE(cx == "SomeClass const volatile *"); -#endif - } - - SECTION("NAMEOF_TYPE_T") { - constexpr auto cx = NAMEOF_TYPE_T(const SomeClass volatile *); -#if defined(__clang__) - static_assert(cx == "const volatile SomeClass *"); - REQUIRE(cx == "const volatile SomeClass *"); -#elif defined(__GNUC__) - static_assert(cx == "const volatile SomeClass*"); - REQUIRE(cx == "const volatile SomeClass*"); -#elif defined(_MSC_VER) - static_assert(cx == "SomeClass const volatile *"); - REQUIRE(cx == "SomeClass const volatile *"); -#endif - } -} - TEST_CASE("NAMEOF") { SECTION("variable") { REQUIRE(NAMEOF(othervar) == "othervar");