File indexing completed on 2025-01-18 09:54:06
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED
0009 #define CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED
0010
0011 #include <catch2/internal/catch_test_registry.hpp>
0012 #include <catch2/internal/catch_compiler_capabilities.hpp>
0013 #include <catch2/internal/catch_preprocessor.hpp>
0014 #include <catch2/internal/catch_meta.hpp>
0015 #include <catch2/internal/catch_unique_name.hpp>
0016
0017
0018
0019
0020
0021 #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5
0022 #pragma GCC diagnostic ignored "-Wunused-variable"
0023 #endif
0024
0025 #if defined(CATCH_CONFIG_DISABLE)
0026 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \
0027 INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))
0028 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
0029 namespace{ \
0030 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
0031 INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
0032 } \
0033 } \
0034 INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
0035
0036 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0037 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
0038 INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ )
0039 #else
0040 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
0041 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
0042 #endif
0043
0044 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0045 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
0046 INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ )
0047 #else
0048 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
0049 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )
0050 #endif
0051
0052 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0053 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
0054 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
0055 #else
0056 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
0057 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
0058 #endif
0059
0060 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0061 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
0062 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
0063 #else
0064 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
0065 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
0066 #endif
0067 #endif
0068
0069
0070
0071 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\
0072 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0073 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0074 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
0075 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0076 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0077 CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \
0078 INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
0079 namespace {\
0080 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
0081 INTERNAL_CATCH_TYPE_GEN\
0082 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
0083 INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\
0084 template<typename...Types> \
0085 struct TestName{\
0086 TestName(){\
0087 size_t index = 0; \
0088 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; \
0089 using expander = size_t[]; \
0090 (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... }; \
0091 }\
0092 };\
0093 static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
0094 TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
0095 return 0;\
0096 }();\
0097 }\
0098 }\
0099 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0100 INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))
0101
0102 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0103 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
0104 INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ )
0105 #else
0106 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
0107 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
0108 #endif
0109
0110 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0111 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
0112 INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ )
0113 #else
0114 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
0115 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )
0116 #endif
0117
0118 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \
0119 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0120 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0121 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
0122 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0123 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0124 CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \
0125 template<typename TestType> static void TestFuncName(); \
0126 namespace {\
0127 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
0128 INTERNAL_CATCH_TYPE_GEN \
0129 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
0130 template<typename... Types> \
0131 struct TestName { \
0132 void reg_tests() { \
0133 size_t index = 0; \
0134 using expander = size_t[]; \
0135 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
0136 constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
0137 constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
0138 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... };\
0139 } \
0140 }; \
0141 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
0142 using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
0143 TestInit t; \
0144 t.reg_tests(); \
0145 return 0; \
0146 }(); \
0147 } \
0148 } \
0149 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0150 template<typename TestType> \
0151 static void TestFuncName()
0152
0153 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0154 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
0155 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)
0156 #else
0157 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
0158 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T, __VA_ARGS__ ) )
0159 #endif
0160
0161 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0162 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
0163 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__)
0164 #else
0165 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
0166 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )
0167 #endif
0168
0169 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\
0170 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0171 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0172 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0173 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0174 CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \
0175 template<typename TestType> static void TestFunc(); \
0176 namespace {\
0177 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
0178 INTERNAL_CATCH_TYPE_GEN\
0179 template<typename... Types> \
0180 struct TestName { \
0181 void reg_tests() { \
0182 size_t index = 0; \
0183 using expander = size_t[]; \
0184 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };\
0185 } \
0186 };\
0187 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
0188 using TestInit = typename convert<TestName, TmplList>::type; \
0189 TestInit t; \
0190 t.reg_tests(); \
0191 return 0; \
0192 }(); \
0193 }}\
0194 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0195 template<typename TestType> \
0196 static void TestFunc()
0197
0198 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \
0199 INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, TmplList )
0200
0201
0202 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
0203 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0204 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0205 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
0206 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0207 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0208 namespace {\
0209 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
0210 INTERNAL_CATCH_TYPE_GEN\
0211 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
0212 INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
0213 INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\
0214 template<typename...Types> \
0215 struct TestNameClass{\
0216 TestNameClass(){\
0217 size_t index = 0; \
0218 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
0219 using expander = size_t[];\
0220 (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... }; \
0221 }\
0222 };\
0223 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
0224 TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
0225 return 0;\
0226 }();\
0227 }\
0228 }\
0229 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0230 INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
0231
0232 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0233 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
0234 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
0235 #else
0236 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
0237 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
0238 #endif
0239
0240 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0241 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
0242 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
0243 #else
0244 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
0245 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
0246 #endif
0247
0248 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\
0249 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0250 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0251 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
0252 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0253 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0254 template<typename TestType> \
0255 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
0256 void test();\
0257 };\
0258 namespace {\
0259 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\
0260 INTERNAL_CATCH_TYPE_GEN \
0261 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
0262 template<typename...Types>\
0263 struct TestNameClass{\
0264 void reg_tests(){\
0265 std::size_t index = 0;\
0266 using expander = std::size_t[];\
0267 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
0268 constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
0269 constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
0270 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... }; \
0271 }\
0272 };\
0273 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
0274 using TestInit = typename create<TestNameClass, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;\
0275 TestInit t;\
0276 t.reg_tests();\
0277 return 0;\
0278 }(); \
0279 }\
0280 }\
0281 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0282 template<typename TestType> \
0283 void TestName<TestType>::test()
0284
0285 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0286 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
0287 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
0288 #else
0289 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
0290 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
0291 #endif
0292
0293 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0294 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
0295 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
0296 #else
0297 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
0298 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
0299 #endif
0300
0301 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \
0302 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0303 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0304 CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0305 CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0306 CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \
0307 template<typename TestType> \
0308 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
0309 void test();\
0310 };\
0311 namespace {\
0312 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
0313 INTERNAL_CATCH_TYPE_GEN\
0314 template<typename...Types>\
0315 struct TestNameClass{\
0316 void reg_tests(){\
0317 size_t index = 0;\
0318 using expander = size_t[];\
0319 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... }; \
0320 }\
0321 };\
0322 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
0323 using TestInit = typename convert<TestNameClass, TmplList>::type;\
0324 TestInit t;\
0325 t.reg_tests();\
0326 return 0;\
0327 }(); \
0328 }}\
0329 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0330 template<typename TestType> \
0331 void TestName<TestType>::test()
0332
0333 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
0334 INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, TmplList )
0335
0336
0337 #endif