Added AnyMatch, AllMatch and NoneMatch

This commit is contained in:
Uriel García Rivas
2020-12-07 17:23:54 -06:00
committed by Martin Hořeňovský
parent ce54ec185f
commit 552af8920d
13 changed files with 518 additions and 10 deletions

View File

@@ -14620,6 +14620,162 @@ There is no extra whitespace here
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Usage of the quantifiers matchers" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Section name="Usage of the AllMatch range matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, AllMatch(Contains(0))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match contains element 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, AllMatch(SizeIs(5))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, AllMatch(StartsWith("C"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match starts with: "C"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, AllMatch(EndsWith("+"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match ends with: "+"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, AllMatch(!IsEmpty())
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } all match not is empty
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, AllMatch(SizeIs(2))
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } all match has size == 2
</Expanded>
</Expression>
<OverallResults successes="6" failures="0" expectedFailures="0"/>
</Section>
<Section name="Usage of the AnyMatch range matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, AnyMatch(Contains(-2))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match contains element -2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, AnyMatch(SizeIs(5))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, AnyMatch(StartsWith("CMak"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match starts with: "CMak"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, AnyMatch(EndsWith("++"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match ends with: "++"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, AnyMatch(Contains(4))
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } any match contains element 4
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, AnyMatch(SizeIs(2))
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } any match has size == 2
</Expanded>
</Expression>
<OverallResults successes="6" failures="0" expectedFailures="0"/>
</Section>
<Section name="Usage of the NoneMatch range matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, NoneMatch(Contains(-6))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match contains element -6
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_arr_arr, NoneMatch(SizeIs(42))
</Original>
<Expanded>
{ { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 42
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, NoneMatch(StartsWith("abd"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match starts with: "abd"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
string_vector, NoneMatch(EndsWith("#!--"))
</Original>
<Expanded>
{ "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match ends with: "#!--"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, NoneMatch(IsEmpty())
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } none match is empty
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" >
<Original>
int_vectors_list, NoneMatch(SizeIs(3))
</Original>
<Expanded>
{ { 1, 2 }, { 3, 4 }, { 5, 6 } } none match has size == 3
</Expanded>
</Expression>
<OverallResults successes="6" failures="0" expectedFailures="0"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Use a custom approx" tags="[Approx][custom]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" >
<Original>
@@ -18598,9 +18754,9 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="1840" failures="149" expectedFailures="21"/>
<OverallResultsCases successes="261" failures="86" expectedFailures="4"/>
<OverallResults successes="1858" failures="149" expectedFailures="21"/>
<OverallResultsCases successes="262" failures="86" expectedFailures="4"/>
</Group>
<OverallResults successes="1840" failures="148" expectedFailures="21"/>
<OverallResultsCases successes="261" failures="86" expectedFailures="4"/>
<OverallResults successes="1858" failures="148" expectedFailures="21"/>
<OverallResultsCases successes="262" failures="86" expectedFailures="4"/>
</Catch>