Improve naming for TEMPLATE_LIST_TEST_CASE_METHOD

It's not often very useful to name tests simply by incrementing numbers.
This change adds a mechanism by which a name can be generated using both
the index of the type in the type list, and also some from the type
itself somehow.
This commit is contained in:
Chris Sarbora 2023-11-29 22:21:00 -08:00
parent c18b88f7e3
commit df90ea39e1
No known key found for this signature in database
GPG Key ID: C20505F0B2F2B4C2
19 changed files with 227 additions and 20 deletions

View File

@ -185,9 +185,10 @@
template<typename... Types> \
struct TestName { \
void reg_tests() { \
using Catch::IndexedTestTypeName; \
size_t index = 0; \
using expander = size_t[]; \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + IndexedTestTypeName<Types>{}(index), Tags } ), index++)... };/* NOLINT */\
} \
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@ -320,9 +321,10 @@
template<typename...Types>\
struct TestNameClass{\
void reg_tests(){\
using Catch::IndexedTestTypeName;\
size_t index = 0;\
using expander = size_t[];\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + IndexedTestTypeName<Types>{}(index), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@ -339,5 +341,13 @@
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
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 )
namespace Catch {
template <typename T>
struct IndexedTestTypeName {
std::string operator()(size_t index) const {
return std::to_string(index);
}
};
}
#endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED

View File

@ -259,6 +259,9 @@ Message from section two
:test-result: FAIL Tabs and newlines show in output
:test-result: PASS Tag alias can be registered against tag patterns
:test-result: PASS Tags with spaces and non-alphanumerical characters are accepted
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--A
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--B
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--C
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 0
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 1
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 2

View File

@ -252,6 +252,9 @@
:test-result: FAIL Tabs and newlines show in output
:test-result: PASS Tag alias can be registered against tag patterns
:test-result: PASS Tags with spaces and non-alphanumerical characters are accepted
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--A
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--B
:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--C
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 0
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 1
:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 2

View File

@ -1748,6 +1748,9 @@ Tag.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]
Tag.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1
@ -2706,7 +2709,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected
test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2280 | 2099 passed | 146 failed | 35 failed as expected

View File

@ -1741,6 +1741,9 @@ Tag.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]
Tag.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
CustomNaming.tests.cpp:<line number>: passed: Template_Foo<TestType>{}.size() == 0 for: 0 == 0
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1
@ -2695,7 +2698,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected
test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2280 | 2099 passed | 146 failed | 35 failed as expected

View File

@ -1588,6 +1588,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 434 | 343 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2260 | 2096 passed | 129 failed | 35 failed as expected
test cases: 437 | 346 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2263 | 2099 passed | 129 failed | 35 failed as expected

View File

@ -11793,6 +11793,39 @@ Tag.tests.cpp:<line number>: PASSED:
with expansion:
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--A
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--B
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--C
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template test case method with test types specified inside std::tuple - MyTypes
- 0
@ -18949,6 +18982,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected
test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2280 | 2099 passed | 146 failed | 35 failed as expected

View File

@ -11786,6 +11786,39 @@ Tag.tests.cpp:<line number>: PASSED:
with expansion:
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--A
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--B
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template list test case with specialized IndexedTestTypeName--NamedTypes--C
-------------------------------------------------------------------------------
CustomNaming.tests.cpp:<line number>
...............................................................................
CustomNaming.tests.cpp:<line number>: PASSED:
REQUIRE( Template_Foo<TestType>{}.size() == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
Template test case method with test types specified inside std::tuple - MyTypes
- 0
@ -18938,6 +18971,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected
test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2280 | 2099 passed | 146 failed | 35 failed as expected

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2289" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2292" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@ -1337,6 +1337,9 @@ at Misc.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Tags with spaces and non-alphanumerical characters are accepted" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 0" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 1" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 2" time="{duration}" status="run"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2289" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2292" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@ -1336,6 +1336,9 @@ at Misc.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Tags with spaces and non-alphanumerical characters are accepted" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Foo" name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 0" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 1" time="{duration}" status="run"/>
<testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 2" time="{duration}" status="run"/>

View File

@ -905,6 +905,9 @@ at Condition.tests.cpp:<line number>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--1" duration="{duration}"/>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--3" duration="{duration}"/>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--6" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--0" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--1" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--2" duration="{duration}"/>

View File

@ -904,6 +904,9 @@ at Condition.tests.cpp:<line number>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--1" duration="{duration}"/>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--3" duration="{duration}"/>
<testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test with a custom separator--6" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" duration="{duration}"/>
<testCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--0" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--1" duration="{duration}"/>
<testCase name="Template test case method with test types specified inside std::tuple with a custom separator--MyTypes--2" duration="{duration}"/>

View File

@ -2833,6 +2833,12 @@ ok {test-number} - registry.add( "[@no square bracket at end", "", Catch::Source
ok {test-number} - testCase.tags.size() == 2 for: 2 == 2
# Tags with spaces and non-alphanumerical characters are accepted
ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
# Template list test case with specialized IndexedTestTypeName--NamedTypes--A
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template list test case with specialized IndexedTestTypeName--NamedTypes--B
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template list test case with specialized IndexedTestTypeName--NamedTypes--C
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template test case method with test types specified inside std::tuple - MyTypes - 0
ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1 == 1
# Template test case method with test types specified inside std::tuple - MyTypes - 1
@ -4583,5 +4589,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2289
1..2292

View File

@ -2826,6 +2826,12 @@ ok {test-number} - registry.add( "[@no square bracket at end", "", Catch::Source
ok {test-number} - testCase.tags.size() == 2 for: 2 == 2
# Tags with spaces and non-alphanumerical characters are accepted
ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
# Template list test case with specialized IndexedTestTypeName--NamedTypes--A
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template list test case with specialized IndexedTestTypeName--NamedTypes--B
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template list test case with specialized IndexedTestTypeName--NamedTypes--C
ok {test-number} - Template_Foo<TestType>{}.size() == 0 for: 0 == 0
# Template test case method with test types specified inside std::tuple - MyTypes - 0
ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1 == 1
# Template test case method with test types specified inside std::tuple - MyTypes - 1
@ -4572,5 +4578,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2289
1..2292

View File

@ -627,6 +627,12 @@
##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"]
##teamcity[testStarted name='Tags with spaces and non-alphanumerical characters are accepted']
##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C' duration="{duration}"]
##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 0']
##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"]
##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 1']

View File

@ -627,6 +627,12 @@
##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"]
##teamcity[testStarted name='Tags with spaces and non-alphanumerical characters are accepted']
##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B' duration="{duration}"]
##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C']
##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C' duration="{duration}"]
##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 0']
##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"]
##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 1']

View File

@ -13710,6 +13710,39 @@ Message from section two
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 0" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" >
<Original>
@ -21894,6 +21927,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2096" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="329" failures="85" expectedFailures="14" skips="6"/>
<OverallResults successes="2099" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="332" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -13710,6 +13710,39 @@ Message from section two
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--A" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--B" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template list test case with specialized IndexedTestTypeName--NamedTypes--C" tags="[class][indexedtesttypename][list][template]" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/CustomNaming.tests.cpp" >
<Original>
Template_Foo&lt;TestType>{}.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 0" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" >
<Original>
@ -21893,6 +21926,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2096" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="329" failures="85" expectedFailures="14" skips="6"/>
<OverallResults successes="2099" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="332" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -67,3 +67,20 @@ TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture, "Template test case method with
{
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
}
// Creating an IndextTestTypeName specialization should alter how template list tests are named.
template<char C> struct NamedType {};
namespace Catch {
template <char C>
struct IndexedTestTypeName<NamedType<C>> {
std::string operator()(size_t) const {
return {C};
}
};
}
using NamedTypes = std::tuple<NamedType<'A'>, NamedType<'B'>, NamedType<'C'>>;
TEMPLATE_LIST_TEST_CASE_METHOD(Template_Foo, "Template list test case with specialized IndexedTestTypeName", "[class][template][list][indexedtesttypename]", NamedTypes)
{
REQUIRE( Template_Foo<TestType>{}.size() == 0 );
}