mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-24 22:36:10 +01:00
Renamed STRINGIFY_ENUM to REGISTER_ENUM
This commit is contained in:
parent
5a74fcc9c9
commit
346723c9b6
@ -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
|
||||||
|
@ -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" );
|
||||||
|
Loading…
Reference in New Issue
Block a user