clean-up test

This commit is contained in:
neargye 2019-03-21 11:25:25 +05:00
parent 7008ed1e37
commit c25c0b607e

View file

@ -82,108 +82,6 @@ const SomeClass<int> 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<int>::SomeMethod6<long int>);
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<int>::SomeMethod6<long int>);
static_assert(cx3 == "SomeMethod6<long int>");
REQUIRE(cx3 == "SomeMethod6<long int>");
// 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<int> *");
REQUIRE(cx == "const volatile SomeClass<int> *");
#elif defined(__GNUC__)
static_assert(cx == "const volatile SomeClass<int>*");
REQUIRE(cx == "const volatile SomeClass<int>*");
#elif defined(_MSC_VER)
static_assert(cx == "SomeClass<int> const volatile *");
REQUIRE(cx == "SomeClass<int> const volatile *");
#endif
}
SECTION("NAMEOF_TYPE_T") {
constexpr auto cx = NAMEOF_TYPE_T(const SomeClass<int> volatile *);
#if defined(__clang__)
static_assert(cx == "const volatile SomeClass<int> *");
REQUIRE(cx == "const volatile SomeClass<int> *");
#elif defined(__GNUC__)
static_assert(cx == "const volatile SomeClass<int>*");
REQUIRE(cx == "const volatile SomeClass<int>*");
#elif defined(_MSC_VER)
static_assert(cx == "SomeClass<int> const volatile *");
REQUIRE(cx == "SomeClass<int> const volatile *");
#endif
}
}
TEST_CASE("NAMEOF") {
SECTION("variable") {
REQUIRE(NAMEOF(othervar) == "othervar");