tmp/tests/debug.cpp

40 lines
1.1 KiB
C++

#include "catch_tmp.h"
#include <debug.h>
using namespace tmp;
#if defined(__clang__)
TEST_CASE("typeName") {
REQUIRE("void" == std::string{typeName<void>()});
REQUIRE("int &" == std::string{typeName<int&>()});
REQUIRE("int *" == std::string{typeName<int*>()});
REQUIRE("const int" == std::string{typeName<int const>()});
REQUIRE("int *const &" == std::string{typeName<int* const&>()});
}
TEST_CASE("strTypes") {
REQUIRE("" == strTypes());
REQUIRE("int" == strTypes<int>());
REQUIRE("int" == strTypes<>(0));
REQUIRE("char, int" == strTypes<char>(0));
}
#elif defined(__GNUC__)
TEST_CASE("typeName") {
REQUIRE("void" == std::string{typeName<void>()});
REQUIRE("int&" == std::string{typeName<int&>()});
REQUIRE("int*" == std::string{typeName<int*>()});
REQUIRE("const int" == std::string{typeName<int const>()});
REQUIRE("int* const&" == std::string{typeName<int* const&>()});
}
TEST_CASE("strTypes") {
REQUIRE("" == strTypes());
REQUIRE("int" == strTypes<int>());
REQUIRE("int" == strTypes<>(0));
REQUIRE("char, int" == strTypes<char>(0));
}
#elif defined(__MSC_VER)
TEST_CASE("typeName") {}
TEST_CASE("strTypes") {}
#endif