Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-12-26 23:09:51 +0100
committerMartin Hořeňovský2020-12-27 20:20:55 +0100
commit77643ce2e56233d7e9d3974b5efdb40b0e9149e1 (patch)
tree29c87f7e64ee52df8e65889164e7761ba88be64d /tests
parent552af8920df24e16738dbb1cb6b46dd52de7804c (diff)
downloadcatch3-77643ce2e56233d7e9d3974b5efdb40b0e9149e1.tar.gz
Add more comprehensive tests for the quantifier matchers
This includes * Testing both positive and negative path through the matchers * Testing them with types whose `begin` and `end` member functions require ADL * Testing them with types that return different types from `begin` and `end`
Diffstat (limited to 'tests')
-rw-r--r--tests/SelfTest/Baselines/automake.sw.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt63
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt357
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt17
-rw-r--r--tests/SelfTest/Baselines/sonarqube.sw.approved.txt15
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt128
-rw-r--r--tests/SelfTest/Baselines/teamcity.sw.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt517
-rw-r--r--tests/SelfTest/UsageTests/MatchersRanges.tests.cpp353
10 files changed, 1155 insertions, 311 deletions
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt
index 4b51b804..87f2a189 100644
--- a/tests/SelfTest/Baselines/automake.sw.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.approved.txt
@@ -237,8 +237,10 @@ Message from section two
:test-result: PASS Trim strings
:test-result: FAIL Unexpected exceptions can be translated
:test-result: PASS Upcasting special member functions
+:test-result: PASS Usage of AllMatch range matcher
+:test-result: PASS Usage of AnyMatch range matcher
+:test-result: PASS Usage of NoneMatch range matcher
:test-result: PASS Usage of the SizeIs range matcher
-:test-result: PASS Usage of the quantifiers matchers
:test-result: PASS Use a custom approx
:test-result: PASS Variadic macros
:test-result: PASS Vector Approx matcher
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index a50cc6e3..1b6fb40c 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1659,6 +1659,51 @@ There is no extra whitespace here
Exception.tests.cpp:<line number>: failed: unexpected exception with message: '3.14'
UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3
UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3
+MatchersRanges.tests.cpp:<line number>: passed: data, AllMatch(SizeIs(5)) for: { { 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
+MatchersRanges.tests.cpp:<line number>: passed: data, !AllMatch(Contains(0) && Contains(1)) for: { { 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 } } not all match ( contains element 0 and contains element 1 )
+MatchersRanges.tests.cpp:<line number>: passed: needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked, allMatch for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked, !allMatch for: { 1, 2, 3, 4, 5 } not all match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: data, AnyMatch(SizeIs(5)) for: { { 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
+MatchersRanges.tests.cpp:<line number>: passed: data, !AnyMatch(Contains(0) && Contains(10)) for: { { 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 } } not any match ( contains element 0 and contains element 10 )
+MatchersRanges.tests.cpp:<line number>: passed: needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked, !anyMatch for: { 1, 2, 3, 4, 5 } not any match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked, anyMatch for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[1]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[2]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: data, NoneMatch(SizeIs(6)) for: { { 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 == 6
+MatchersRanges.tests.cpp:<line number>: passed: data, !NoneMatch(Contains(0) && Contains(1)) for: { { 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 } } not none match ( contains element 0 and contains element 1 )
+MatchersRanges.tests.cpp:<line number>: passed: needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked, noneMatch for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true
+MatchersRanges.tests.cpp:<line number>: passed: mocked, !noneMatch for: { 1, 2, 3, 4, 5 } not none match matches undescribed predicate
+MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[1]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[2]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false
+MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false
MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(0) for: { } has size == 0
MatchersRanges.tests.cpp:<line number>: passed: empty_vec, !SizeIs(2) for: { } not has size == 2
MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(Lt(2)) for: { } size matches is less than 2
@@ -1668,24 +1713,6 @@ MatchersRanges.tests.cpp:<line number>: passed: arr, !SizeIs(!Lt(3)) for: { 0, 0
MatchersRanges.tests.cpp:<line number>: passed: map, SizeIs(3) for: { {?}, {?}, {?} } has size == 3
MatchersRanges.tests.cpp:<line number>: passed: unrelated::ADL_size{}, SizeIs(12) for: {?} has size == 12
MatchersRanges.tests.cpp:<line number>: passed: has_size{}, SizeIs(13) for: {?} has size == 13
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, AllMatch(Contains(0)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, AllMatch(SizeIs(5)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, AllMatch(StartsWith("C")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match starts with: "C"
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, AllMatch(EndsWith("+")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match ends with: "+"
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, AllMatch(!IsEmpty()) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match not is empty
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, AllMatch(SizeIs(2)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match has size == 2
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, AnyMatch(Contains(-2)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, AnyMatch(SizeIs(5)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, AnyMatch(StartsWith("CMak")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match starts with: "CMak"
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, AnyMatch(EndsWith("++")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match ends with: "++"
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, AnyMatch(Contains(4)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match contains element 4
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, AnyMatch(SizeIs(2)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match has size == 2
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, NoneMatch(Contains(-6)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: int_arr_arr, NoneMatch(SizeIs(42)) for: { { 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
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, NoneMatch(StartsWith("abd")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match starts with: "abd"
-MatchersRanges.tests.cpp:<line number>: passed: string_vector, NoneMatch(EndsWith("#!--")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match ends with: "#!--"
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, NoneMatch(IsEmpty()) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match is empty
-MatchersRanges.tests.cpp:<line number>: passed: int_vectors_list, NoneMatch(SizeIs(3)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match has size == 3
Approx.tests.cpp:<line number>: passed: d == approx( 1.23 ) for: 1.23 == Approx( 1.23 )
Approx.tests.cpp:<line number>: passed: d == approx( 1.22 ) for: 1.23 == Approx( 1.22 )
Approx.tests.cpp:<line number>: passed: d == approx( 1.24 ) for: 1.23 == Approx( 1.24 )
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index acd627ee..149bed95 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
-test cases: 352 | 278 passed | 70 failed | 4 failed as expected
-assertions: 2010 | 1858 passed | 131 failed | 21 failed as expected
+test cases: 354 | 280 passed | 70 failed | 4 failed as expected
+assertions: 2037 | 1885 passed | 131 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index 2dd42716..08b69583 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -12221,193 +12221,394 @@ with expansion:
3 == 3
-------------------------------------------------------------------------------
-Usage of the SizeIs range matcher
- Some with stdlib containers
+Usage of AllMatch range matcher
+ Basic usage
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( empty_vec, SizeIs(0) )
+ REQUIRE_THAT( data, AllMatch(SizeIs(5)) )
with expansion:
- { } has size == 0
+ { { 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
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( empty_vec, !SizeIs(2) )
+ REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) )
with expansion:
- { } not has size == 2
+ { { 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 } } not all match ( contains element 0 and contains
+ element 1 )
+
+-------------------------------------------------------------------------------
+Usage of AllMatch range matcher
+ Type requires ADL found begin and end
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( empty_vec, SizeIs(Lt(2)) )
+ REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) )
with expansion:
- { } size matches is less than 2
+ { 1, 2, 3, 4, 5 } all match matches undescribed predicate
+
+-------------------------------------------------------------------------------
+Usage of AllMatch range matcher
+ Shortcircuiting
+ All are read
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( arr, SizeIs(2) )
+ REQUIRE_THAT( mocked, allMatch )
with expansion:
- { 0, 0 } has size == 2
+ { 1, 2, 3, 4, 5 } all match matches undescribed predicate
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( arr, SizeIs( Lt(3)) )
+ REQUIRE( mocked.derefed[0] )
with expansion:
- { 0, 0 } size matches is less than 3
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( arr, !SizeIs(!Lt(3)) )
+ REQUIRE( mocked.derefed[1] )
with expansion:
- { 0, 0 } not size matches not is less than 3
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( map, SizeIs(3) )
+ REQUIRE( mocked.derefed[2] )
with expansion:
- { {?}, {?}, {?} } has size == 3
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[3] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[4] )
+with expansion:
+ true
-------------------------------------------------------------------------------
-Usage of the SizeIs range matcher
- Type requires ADL found size free function
+Usage of AllMatch range matcher
+ Shortcircuiting
+ Short-circuited
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( unrelated::ADL_size{}, SizeIs(12) )
+ REQUIRE_THAT( mocked, !allMatch )
with expansion:
- {?} has size == 12
+ { 1, 2, 3, 4, 5 } not all match matches undescribed predicate
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[0] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[1] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[2] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[3] )
+with expansion:
+ !false
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[4] )
+with expansion:
+ !false
-------------------------------------------------------------------------------
-Usage of the SizeIs range matcher
- Type has size member
+Usage of AnyMatch range matcher
+ Basic usage
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( has_size{}, SizeIs(13) )
+ REQUIRE_THAT( data, AnyMatch(SizeIs(5)) )
with expansion:
- {?} has size == 13
+ { { 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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) )
+with expansion:
+ { { 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 } } not any match ( contains element 0 and contains
+ element 10 )
-------------------------------------------------------------------------------
-Usage of the quantifiers matchers
- Usage of the AllMatch range matcher
+Usage of AnyMatch range matcher
+ Type requires ADL found begin and end
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, AllMatch(Contains(0)) )
+ REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) )
with expansion:
- { { 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
+ { 1, 2, 3, 4, 5 } any match matches undescribed predicate
+
+-------------------------------------------------------------------------------
+Usage of AnyMatch range matcher
+ Shortcircuiting
+ All are read
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, AllMatch(SizeIs(5)) )
+ REQUIRE_THAT( mocked, !anyMatch )
with expansion:
- { { 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
+ { 1, 2, 3, 4, 5 } not any match matches undescribed predicate
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, AllMatch(StartsWith("C")) )
+ REQUIRE( mocked.derefed[0] )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match starts with:
- "C"
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, AllMatch(EndsWith("+")) )
+ REQUIRE( mocked.derefed[1] )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match ends with:
- "+"
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[2] )
+with expansion:
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, AllMatch(!IsEmpty()) )
+ REQUIRE( mocked.derefed[3] )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match not is empty
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, AllMatch(SizeIs(2)) )
+ REQUIRE( mocked.derefed[4] )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match has size == 2
+ true
-------------------------------------------------------------------------------
-Usage of the quantifiers matchers
- Usage of the AnyMatch range matcher
+Usage of AnyMatch range matcher
+ Shortcircuiting
+ Short-circuited
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, AnyMatch(Contains(-2)) )
+ REQUIRE_THAT( mocked, anyMatch )
with expansion:
- { { 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
+ { 1, 2, 3, 4, 5 } any match matches undescribed predicate
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, AnyMatch(SizeIs(5)) )
+ REQUIRE( mocked.derefed[0] )
with expansion:
- { { 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
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, AnyMatch(StartsWith("CMak")) )
+ REQUIRE_FALSE( mocked.derefed[1] )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match starts with:
- "CMak"
+ !false
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, AnyMatch(EndsWith("++")) )
+ REQUIRE_FALSE( mocked.derefed[2] )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match ends with:
- "++"
+ !false
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, AnyMatch(Contains(4)) )
+ REQUIRE_FALSE( mocked.derefed[3] )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match contains element 4
+ !false
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, AnyMatch(SizeIs(2)) )
+ REQUIRE_FALSE( mocked.derefed[4] )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match has size == 2
+ !false
-------------------------------------------------------------------------------
-Usage of the quantifiers matchers
- Usage of the NoneMatch range matcher
+Usage of NoneMatch range matcher
+ Basic usage
-------------------------------------------------------------------------------
MatchersRanges.tests.cpp:<line number>
...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, NoneMatch(Contains(-6)) )
+ REQUIRE_THAT( data, NoneMatch(SizeIs(6)) )
with expansion:
{ { 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
+ }, { 1, 0, 0, -1, 5 } } none match has size == 6
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_arr_arr, NoneMatch(SizeIs(42)) )
+ REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) )
with expansion:
{ { 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
+ }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains
+ element 1 )
+
+-------------------------------------------------------------------------------
+Usage of NoneMatch range matcher
+ Type requires ADL found begin and end
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, NoneMatch(StartsWith("abd")) )
+ REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match starts
- with: "abd"
+ { 1, 2, 3, 4, 5 } none match matches undescribed predicate
+
+-------------------------------------------------------------------------------
+Usage of NoneMatch range matcher
+ Shortcircuiting
+ All are read
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( mocked, noneMatch )
+with expansion:
+ { 1, 2, 3, 4, 5 } none match matches undescribed predicate
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[0] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[1] )
+with expansion:
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[2] )
+with expansion:
+ true
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( string_vector, NoneMatch(EndsWith("#!--")) )
+ REQUIRE( mocked.derefed[3] )
with expansion:
- { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match ends with:
- "#!--"
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE( mocked.derefed[4] )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Usage of NoneMatch range matcher
+ Shortcircuiting
+ Short-circuited
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, NoneMatch(IsEmpty()) )
+ REQUIRE_THAT( mocked, !noneMatch )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match is empty
+ { 1, 2, 3, 4, 5 } not none match matches undescribed predicate
MatchersRanges.tests.cpp:<line number>: PASSED:
- REQUIRE_THAT( int_vectors_list, NoneMatch(SizeIs(3)) )
+ REQUIRE( mocked.derefed[0] )
with expansion:
- { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match has size == 3
+ true
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[1] )
+with expansion:
+ !false
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[2] )
+with expansion:
+ !false
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[3] )
+with expansion:
+ !false
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_FALSE( mocked.derefed[4] )
+with expansion:
+ !false
+
+-------------------------------------------------------------------------------
+Usage of the SizeIs range matcher
+ Some with stdlib containers
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( empty_vec, SizeIs(0) )
+with expansion:
+ { } has size == 0
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( empty_vec, !SizeIs(2) )
+with expansion:
+ { } not has size == 2
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( empty_vec, SizeIs(Lt(2)) )
+with expansion:
+ { } size matches is less than 2
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( arr, SizeIs(2) )
+with expansion:
+ { 0, 0 } has size == 2
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( arr, SizeIs( Lt(3)) )
+with expansion:
+ { 0, 0 } size matches is less than 3
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( arr, !SizeIs(!Lt(3)) )
+with expansion:
+ { 0, 0 } not size matches not is less than 3
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( map, SizeIs(3) )
+with expansion:
+ { {?}, {?}, {?} } has size == 3
+
+-------------------------------------------------------------------------------
+Usage of the SizeIs range matcher
+ Type requires ADL found size free function
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( unrelated::ADL_size{}, SizeIs(12) )
+with expansion:
+ {?} has size == 12
+
+-------------------------------------------------------------------------------
+Usage of the SizeIs range matcher
+ Type has size member
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( has_size{}, SizeIs(13) )
+with expansion:
+ {?} has size == 13
-------------------------------------------------------------------------------
Use a custom approx
@@ -15804,6 +16005,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 352 | 262 passed | 86 failed | 4 failed as expected
-assertions: 2027 | 1858 passed | 148 failed | 21 failed as expected
+test cases: 354 | 264 passed | 86 failed | 4 failed as expected
+assertions: 2054 | 1885 passed | 148 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index 214e03e8..c7e3d02c 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
- <testsuite name="<exe-name>" errors="17" failures="132" tests="2028" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="2055" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
@@ -1280,12 +1280,21 @@ Exception.tests.cpp:<line number>
</testcase>
<testcase classname="<exe-name>.global" name="Upcasting special member functions/Move constructor" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Upcasting special member functions/move assignment" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Basic usage" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Basic usage" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Basic usage" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/>
+ <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Some with stdlib containers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type requires ADL found size free function" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type has size member" time="{duration}" status="run"/>
- <testcase classname="<exe-name>.global" name="Usage of the quantifiers matchers/Usage of the AllMatch range matcher" time="{duration}" status="run"/>
- <testcase classname="<exe-name>.global" name="Usage of the quantifiers matchers/Usage of the AnyMatch range matcher" time="{duration}" status="run"/>
- <testcase classname="<exe-name>.global" name="Usage of the quantifiers matchers/Usage of the NoneMatch range matcher" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Use a custom approx" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Variadic macros/Section with one argument" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Vector Approx matcher/Empty vector is roughly equal to an empty vector" time="{duration}" status="run"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
index ed78a3a9..736b1b4f 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/