mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 21:35:40 +02:00
Added AnyMatch, AllMatch and NoneMatch
This commit is contained in:

committed by
Martin Hořeňovský

parent
ce54ec185f
commit
552af8920d
@@ -3179,6 +3179,42 @@ ok {test-number} - map, SizeIs(3) for: { {?}, {?}, {?} } has size == 3
|
||||
ok {test-number} - unrelated::ADL_size{}, SizeIs(12) for: {?} has size == 12
|
||||
# Usage of the SizeIs range matcher
|
||||
ok {test-number} - has_size{}, SizeIs(13) for: {?} has size == 13
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, AllMatch(StartsWith("C")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match starts with: "C"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, AllMatch(EndsWith("+")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match ends with: "+"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, AllMatch(!IsEmpty()) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match not is empty
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, AllMatch(SizeIs(2)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match has size == 2
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, AnyMatch(StartsWith("CMak")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match starts with: "CMak"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, AnyMatch(EndsWith("++")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match ends with: "++"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, AnyMatch(Contains(4)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match contains element 4
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, AnyMatch(SizeIs(2)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match has size == 2
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - 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
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, NoneMatch(StartsWith("abd")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match starts with: "abd"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - string_vector, NoneMatch(EndsWith("#!--")) for: { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match ends with: "#!--"
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, NoneMatch(IsEmpty()) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match is empty
|
||||
# Usage of the quantifiers matchers
|
||||
ok {test-number} - int_vectors_list, NoneMatch(SizeIs(3)) for: { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match has size == 3
|
||||
# Use a custom approx
|
||||
ok {test-number} - d == approx( 1.23 ) for: 1.23 == Approx( 1.23 )
|
||||
# Use a custom approx
|
||||
@@ -4010,5 +4046,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2009
|
||||
1..2027
|
||||
|
||||
|
Reference in New Issue
Block a user