Renamed STRINGIFY_ENUM to REGISTER_ENUM

This commit is contained in:
Phil Nash 2019-04-21 20:15:26 +03:00
parent 5a74fcc9c9
commit 346723c9b6
2 changed files with 5 additions and 5 deletions

View File

@ -640,7 +640,7 @@ struct ratio_string<std::milli> {
} }
#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER #endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
#define INTERNAL_CATCH_STRINGIFY_ENUM( enumName, ... ) \ #define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \
template<> struct ::Catch::StringMaker<enumName> { \ template<> struct ::Catch::StringMaker<enumName> { \
static std::string convert( enumName value ) { \ static std::string convert( enumName value ) { \
static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \ static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \
@ -649,9 +649,9 @@ struct ratio_string<std::milli> {
}; };
#ifdef CATCH_CONFIG_PREFIX_ALL #ifdef CATCH_CONFIG_PREFIX_ALL
# define CATCH_STRINGIFY_ENUM( enumName, ... ) INTERNAL_CATCH_STRINGIFY_ENUM( enumName, __VA_ARGS__ ) # define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
#else #else
# define STRINGIFY_ENUM( enumName, ... ) INTERNAL_CATCH_STRINGIFY_ENUM( enumName, __VA_ARGS__ ) # define REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -67,10 +67,10 @@ TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass]" )
enum class EnumClass3 { Value1, Value2, Value3, Value4 }; enum class EnumClass3 { Value1, Value2, Value3, Value4 };
STRINGIFY_ENUM( EnumClass3, EnumClass3::Value1, EnumClass3::Value2, EnumClass3::Value3 ) REGISTER_ENUM( EnumClass3, EnumClass3::Value1, EnumClass3::Value2, EnumClass3::Value3 )
TEST_CASE( "STRINGIFY_ENUM" ) { TEST_CASE( "REGISTER_ENUM" ) {
using Catch::Detail::stringify; using Catch::Detail::stringify;
REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" ); REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" );
REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" ); REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" );