From 7f8ba456a2d40e5c5935791712a1078e2ab9e481 Mon Sep 17 00:00:00 2001 From: Neargye Date: Mon, 3 Sep 2018 17:42:46 +0500 Subject: [PATCH] update test --- test/test.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/test/test.cpp b/test/test.cpp index 49c72b9..8b9a722 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -306,23 +306,31 @@ TEST_CASE("NAMEOF_RAW") { } TEST_CASE("NAMEOF_ENUM") { -# if defined(__clang__) || defined(_MSC_VER) + Color color_ = Color::BLUE; + Color m[3] = {Color::RED, Color::GREEN, Color::BLUE}; +#if defined(__clang__) || defined(_MSC_VER) REQUIRE(NAMEOF_ENUM(Color::RED) == "RED"); - REQUIRE(NAMEOF_ENUM(::color) == "RED"); + REQUIRE(NAMEOF_ENUM(color) == "RED"); - auto color_ = Color::BLUE; REQUIRE(NAMEOF_ENUM(Color::BLUE) == "BLUE"); REQUIRE(NAMEOF_ENUM(color_) == "BLUE"); + REQUIRE(NAMEOF_ENUM(m[1]) == "GREEN"); + REQUIRE(NAMEOF_ENUM(Directions::Right) == "Right"); REQUIRE(NAMEOF_ENUM(directions) == "Right"); -# elif defined(__GNUC__) +#elif defined(__GNUC__) REQUIRE(NAMEOF_ENUM(Color::RED) == "(Color)-1"); - REQUIRE(NAMEOF_ENUM(color) == "(const Color)-1"); + REQUIRE(NAMEOF_ENUM(color) == "(Color)-1"); + + REQUIRE(NAMEOF_ENUM(Color::BLUE) == "(Color)1"); + REQUIRE(NAMEOF_ENUM(color_) == "(Color)1"); + + REQUIRE(NAMEOF_ENUM(m[1]) == "(Color)0"); REQUIRE(NAMEOF_ENUM(Directions::Right) == "(Directions)2"); - REQUIRE(NAMEOF_ENUM(directions) == "(const Directions)2"); -# endif + REQUIRE(NAMEOF_ENUM(directions) == "(Directions)2"); +#endif } TEST_CASE("NAMEOF_TYPE") { @@ -434,7 +442,7 @@ TEST_CASE("Spaces and Tabs ignored") { #if defined(__clang__) || defined(_MSC_VER) REQUIRE(NAMEOF_ENUM( color ) == "RED"); #elif defined(__GNUC__) - REQUIRE(NAMEOF_ENUM( color ) == "(const Color)-1"); + REQUIRE(NAMEOF_ENUM( color ) == "(Color)-1"); #endif REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct"); REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct"); @@ -447,7 +455,7 @@ TEST_CASE("Spaces and Tabs ignored") { #if defined(__clang__) || defined(_MSC_VER) REQUIRE(NAMEOF_ENUM( color ) == "RED"); #elif defined(__GNUC__) - REQUIRE(NAMEOF_ENUM( color ) == "(const Color)-1"); + REQUIRE(NAMEOF_ENUM( color ) == "(Color)-1"); #endif REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct"); REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct");