clen-up test
This commit is contained in:
parent
a8f3fc2114
commit
590c6e3890
1 changed files with 51 additions and 36 deletions
|
@ -51,6 +51,30 @@ int someVar = 0;
|
||||||
|
|
||||||
enum class Color { RED, GREEN, BLUE };
|
enum class Color { RED, GREEN, BLUE };
|
||||||
|
|
||||||
|
TEST_CASE("constexpr") {
|
||||||
|
SomeStruct someVar;
|
||||||
|
|
||||||
|
SECTION("NAMEOF") {
|
||||||
|
constexpr auto n = NAMEOF(someVar);
|
||||||
|
REQUIRE(std::strcmp(n, "someVar") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("NAMEOF_FULL") {
|
||||||
|
constexpr auto n = NAMEOF_FULL((&someVar)->SomeField);
|
||||||
|
REQUIRE(std::strcmp(n, "(&someVar)->SomeField") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("NAMEOF_TYPE") {
|
||||||
|
constexpr auto n = NAMEOF_TYPE(std::string);
|
||||||
|
REQUIRE(std::strcmp(n, "string") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("NAMEOF_TYPE_FULL") {
|
||||||
|
constexpr auto n = NAMEOF_TYPE_FULL(std::string);
|
||||||
|
REQUIRE(std::strcmp(n, "std::string") == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("NAMEOF") {
|
TEST_CASE("NAMEOF") {
|
||||||
SomeStruct someVar;
|
SomeStruct someVar;
|
||||||
Long otherVar;
|
Long otherVar;
|
||||||
|
@ -58,14 +82,8 @@ TEST_CASE("NAMEOF") {
|
||||||
SomeStruct* ptrVar;
|
SomeStruct* ptrVar;
|
||||||
SomeStruct** ptrptrVar;
|
SomeStruct** ptrptrVar;
|
||||||
|
|
||||||
SECTION("constexpr") {
|
SECTION("NAMEOF_VARIABLE") {
|
||||||
constexpr auto constexpr_work_fine = NAMEOF(intValue);
|
|
||||||
REQUIRE(std::strcmp(constexpr_work_fine, "intValue") == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("NAMEOF") {
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(someVar), "someVar") == 0);
|
REQUIRE(std::strcmp(NAMEOF(someVar), "someVar") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(Color::RED), "RED") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(someVar.SomeField), "SomeField") == 0);
|
REQUIRE(std::strcmp(NAMEOF(someVar.SomeField), "SomeField") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF((&someVar)->SomeField), "SomeField") == 0);
|
REQUIRE(std::strcmp(NAMEOF((&someVar)->SomeField), "SomeField") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(::someVar), "someVar") == 0);
|
REQUIRE(std::strcmp(NAMEOF(::someVar), "someVar") == 0);
|
||||||
|
@ -80,15 +98,6 @@ TEST_CASE("NAMEOF") {
|
||||||
REQUIRE(std::strcmp(NAMEOF(-intValue), "intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF(-intValue), "intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(~intValue), "intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF(~intValue), "intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(!intValue), "intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF(!intValue), "intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(someVar.SomeMethod1()), "SomeMethod1()") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(&SomeStruct::SomeMethod2), "SomeMethod2") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(SomeMethod3), "SomeMethod3") == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("NAMEOF_VARIABLE") {
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(someVar.SomeField), "SomeField") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF((&someVar)->SomeField), "SomeField") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF(::someVar), "someVar") == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("NAMEOF_FUNCTION") {
|
SECTION("NAMEOF_FUNCTION") {
|
||||||
|
@ -96,15 +105,22 @@ TEST_CASE("NAMEOF") {
|
||||||
REQUIRE(std::strcmp(NAMEOF(&SomeStruct::SomeMethod2), "SomeMethod2") == 0);
|
REQUIRE(std::strcmp(NAMEOF(&SomeStruct::SomeMethod2), "SomeMethod2") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF(SomeMethod3), "SomeMethod3") == 0);
|
REQUIRE(std::strcmp(NAMEOF(SomeMethod3), "SomeMethod3") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("NAMEOF_ENUM") {
|
||||||
|
REQUIRE(std::strcmp(NAMEOF(Color::RED), "RED") == 0);
|
||||||
|
REQUIRE(std::strcmp(NAMEOF(Color::BLUE), "BLUE") == 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("NAMEOF_TYPE") {
|
TEST_CASE("NAMEOF_TYPE") {
|
||||||
|
SECTION("NAMEOF_TYPE") {
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE(int[]), "int[]") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE(int[]), "int[]") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE(int), "int") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE(int), "int") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE(std::string), "string") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE(std::string), "string") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE(SomeStruct), "SomeStruct") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE(SomeStruct), "SomeStruct") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE(Long::LL), "LL") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE(Long::LL), "LL") == 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("NAMEOF_FULL") {
|
TEST_CASE("NAMEOF_FULL") {
|
||||||
SomeStruct someVar;
|
SomeStruct someVar;
|
||||||
|
@ -113,7 +129,7 @@ TEST_CASE("NAMEOF_FULL") {
|
||||||
SomeStruct* ptrVar;
|
SomeStruct* ptrVar;
|
||||||
SomeStruct** ptrptrVar;
|
SomeStruct** ptrptrVar;
|
||||||
|
|
||||||
SECTION("NAMEOF_FULL") {
|
SECTION("NAMEOF_VARIABLE_FULL") {
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(someVar), "someVar") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(someVar), "someVar") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeField), "someVar.SomeField") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeField), "someVar.SomeField") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL((&someVar)->SomeField), "(&someVar)->SomeField") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL((&someVar)->SomeField), "(&someVar)->SomeField") == 0);
|
||||||
|
@ -129,28 +145,27 @@ TEST_CASE("NAMEOF_FULL") {
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(-intValue), "-intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(-intValue), "-intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(~intValue), "~intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(~intValue), "~intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(!intValue), "!intValue") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(!intValue), "!intValue") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeMethod1()), "someVar.SomeMethod1()") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(&SomeStruct::SomeMethod2), "&SomeStruct::SomeMethod2") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(SomeMethod3), "SomeMethod3") == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("NAMEOF_VARIABLE_FULL") {
|
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeField), "someVar.SomeField") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL((&someVar)->SomeField), "(&someVar)->SomeField") == 0);
|
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(::someVar), "::someVar") == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("NAMEOF_FUNCTION_FULL") {
|
SECTION("NAMEOF_FUNCTION_FULL") {
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeMethod1()), "someVar.SomeMethod1()") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(someVar.SomeMethod1()), "someVar.SomeMethod1()") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(&SomeStruct::SomeMethod2), "&SomeStruct::SomeMethod2") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(&SomeStruct::SomeMethod2), "&SomeStruct::SomeMethod2") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_FULL(SomeMethod3), "SomeMethod3") == 0);
|
REQUIRE(std::strcmp(NAMEOF_FULL(SomeMethod3), "SomeMethod3") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("NAMEOF_ENUM_FULL") {
|
||||||
|
REQUIRE(std::strcmp(NAMEOF_FULL(Color::RED), "Color::RED") == 0);
|
||||||
|
REQUIRE(std::strcmp(NAMEOF_FULL(Color::BLUE), "Color::BLUE") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("NAMEOF_TYPE_FULL") {
|
TEST_CASE("NAMEOF_TYPE_FULL") {
|
||||||
|
SECTION("NAMEOF_TYPE_FULL") {
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(int[]), "int[]") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(int[]), "int[]") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(int), "int") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(int), "int") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(std::string), "std::string") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(std::string), "std::string") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(SomeStruct), "SomeStruct") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(SomeStruct), "SomeStruct") == 0);
|
||||||
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(Long::LL), "Long::LL") == 0);
|
REQUIRE(std::strcmp(NAMEOF_TYPE_FULL(Long::LL), "Long::LL") == 0);
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue