mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Refactor implementation of case-insensitivity in tags
By not materializing the lower cased tags ahead of time, we save allocations at the cost of worsened performance when comparing two tags. Since there are rarely many tags, and commonly they are not compared even if present, this is almost always a win. The new implementation also improves the robustness of the code responsible for handling tags in a case-insensitive manner.
This commit is contained in:
@@ -2281,7 +2281,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.itera
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: Timing.iterations >= time.count() for: 128 >= 100
|
||||
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
|
||||
Tag.tests.cpp:<line number>: passed: tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) for: { ., magic-tag } ( Contains: magic-tag and Contains: . )
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
|
||||
|
@@ -16278,9 +16278,9 @@ Tag.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) )
|
||||
REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) )
|
||||
with expansion:
|
||||
{ ., magic-tag } ( Contains: magic-tag and Contains: . )
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
splitString
|
||||
|
@@ -4119,7 +4119,7 @@ not ok {test-number} - false with 1 message: '3'
|
||||
# sends information to INFO
|
||||
not ok {test-number} - false with 2 messages: 'hi' and 'i := 7'
|
||||
# shortened hide tags are split apart
|
||||
ok {test-number} - tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) for: { ., magic-tag } ( Contains: magic-tag and Contains: . )
|
||||
ok {test-number} - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
# splitString
|
||||
ok {test-number} - splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
|
||||
# splitString
|
||||
|
@@ -19158,10 +19158,10 @@ loose text artifact
|
||||
<TestCase name="shortened hide tags are split apart" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
|
||||
<Original>
|
||||
tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr)
|
||||
testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) )
|
||||
</Original>
|
||||
<Expanded>
|
||||
{ ., magic-tag } ( Contains: magic-tag and Contains: . )
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
|
Reference in New Issue
Block a user