From 0bc32fe6760f84f2e6ce7cd3fe1880a8cdc22dd5 Mon Sep 17 00:00:00 2001 From: Neargye Date: Sun, 15 Apr 2018 00:12:32 +0500 Subject: [PATCH] add macros case test --- test/test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test.cpp b/test/test.cpp index bec5a55..9c1136a 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -73,6 +73,9 @@ TEST_CASE("constexpr") { // enum constexpr auto cx4 = NAMEOF(Color::RED); REQUIRE(std::strcmp(cx4, "RED") == 0); + // macros + constexpr auto cx5 = NAMEOF(__cplusplus); + REQUIRE(std::strcmp(cx5, "__cplusplus") == 0); } SECTION("NAMEOF_FULL") { @@ -88,6 +91,9 @@ TEST_CASE("constexpr") { // enum constexpr auto cx4 = NAMEOF_FULL(Color::RED); REQUIRE(std::strcmp(cx4, "Color::RED") == 0); + // macros + constexpr auto cx5 = NAMEOF_FULL(__cplusplus); + REQUIRE(std::strcmp(cx5, "__cplusplus") == 0); } } @@ -141,6 +147,12 @@ TEST_CASE("NAMEOF") { REQUIRE(std::strcmp(NAMEOF(Color::RED), "RED") == 0); REQUIRE(std::strcmp(NAMEOF(Color::BLUE), "BLUE") == 0); } + + SECTION("macros") { + REQUIRE(std::strcmp(NAMEOF(__cplusplus), "__cplusplus") == 0); + REQUIRE(std::strcmp(NAMEOF(__LINE__), "__LINE__") == 0); + REQUIRE(std::strcmp(NAMEOF(__FILE__), "__FILE__") == 0); + } } TEST_CASE("NAMEOF_FULL") { @@ -193,4 +205,10 @@ TEST_CASE("NAMEOF_FULL") { REQUIRE(std::strcmp(NAMEOF_FULL(Color::RED), "Color::RED") == 0); REQUIRE(std::strcmp(NAMEOF_FULL(Color::BLUE), "Color::BLUE") == 0); } + + SECTION("macros") { + REQUIRE(std::strcmp(NAMEOF_FULL(__cplusplus), "__cplusplus") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL(__LINE__), "__LINE__") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL(__FILE__), "__FILE__") == 0); + } }