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

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorUriel García Rivas2020-12-07 17:23:54 -0600
committerMartin Hořeňovský2020-12-27 20:20:55 +0100
commit552af8920df24e16738dbb1cb6b46dd52de7804c (patch)
treec336ff726945350d6943488dbf1102be43246533
parentce54ec185f69e32661efdcb4659f892415316b0e (diff)
downloadcatch3-552af8920df24e16738dbb1cb6b46dd52de7804c.tar.gz
Added AnyMatch, AllMatch and NoneMatch
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/catch2/matchers/catch_matchers_all.hpp1
-rw-r--r--src/catch2/matchers/catch_matchers_quantifiers.hpp109
-rw-r--r--tests/SelfTest/Baselines/automake.sw.approved.txt1
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt18
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt127
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt5
-rw-r--r--tests/SelfTest/Baselines/sonarqube.sw.approved.txt3
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt38
-rw-r--r--tests/SelfTest/Baselines/teamcity.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt164
-rw-r--r--tests/SelfTest/UsageTests/MatchersRanges.tests.cpp55
13 files changed, 518 insertions, 10 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e19bd639..15fe1e7e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -88,6 +88,7 @@ set(INTERNAL_HEADERS
${SOURCES_DIR}/matchers/catch_matchers_exception.hpp
${SOURCES_DIR}/matchers/catch_matchers_floating_point.hpp
${SOURCES_DIR}/matchers/catch_matchers_predicate.hpp
+ ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.hpp
${SOURCES_DIR}/matchers/catch_matchers_string.hpp
${SOURCES_DIR}/matchers/catch_matchers_templated.hpp
${SOURCES_DIR}/matchers/catch_matchers_vector.hpp
diff --git a/src/catch2/matchers/catch_matchers_all.hpp b/src/catch2/matchers/catch_matchers_all.hpp
index 6466b8ab..3c0bb9f5 100644
--- a/src/catch2/matchers/catch_matchers_all.hpp
+++ b/src/catch2/matchers/catch_matchers_all.hpp
@@ -26,6 +26,7 @@
#include <catch2/matchers/catch_matchers_exception.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/matchers/catch_matchers_predicate.hpp>
+#include <catch2/matchers/catch_matchers_quantifiers.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <catch2/matchers/catch_matchers_templated.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
diff --git a/src/catch2/matchers/catch_matchers_quantifiers.hpp b/src/catch2/matchers/catch_matchers_quantifiers.hpp
new file mode 100644
index 00000000..09a8c128
--- /dev/null
+++ b/src/catch2/matchers/catch_matchers_quantifiers.hpp
@@ -0,0 +1,109 @@
+
+// Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+#ifndef CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED
+#define CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED
+
+#include <catch2/matchers/catch_matchers_templated.hpp>
+
+#include <utility>
+
+namespace Catch {
+ namespace Matchers {
+ // Matcher for checking that all elements in range matches a given matcher.
+ template <typename Matcher>
+ class AllMatchMatcher final : public MatcherGenericBase {
+ Matcher m_matcher;
+ public:
+ AllMatchMatcher(Matcher matcher):
+ m_matcher(std::move(matcher))
+ {}
+
+ std::string describe() const override {
+ return "all match " + m_matcher.describe();
+ }
+
+ template <typename RangeLike>
+ bool match(RangeLike&& rng) const {
+ for (auto&& elem : rng) {
+ if (!m_matcher.match(elem)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+
+ // Matcher for checking that no element in range matches a given matcher.
+ template <typename Matcher>
+ class NoneMatchMatcher final : public MatcherGenericBase {
+ Matcher m_matcher;
+ public:
+ NoneMatchMatcher(Matcher matcher):
+ m_matcher(std::move(matcher))
+ {}
+
+ std::string describe() const override {
+ return "none match " + m_matcher.describe();
+ }
+
+ template <typename RangeLike>
+ bool match(RangeLike&& rng) const {
+ for (auto&& elem : rng) {
+ if (m_matcher.match(elem)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+
+ // Matcher for checking that at least one element in range matches a given matcher.
+ template <typename Matcher>
+ class AnyMatchMatcher final : public MatcherGenericBase {
+ Matcher m_matcher;
+ public:
+ AnyMatchMatcher(Matcher matcher):
+ m_matcher(std::move(matcher))
+ {}
+
+ std::string describe() const override {
+ return "any match " + m_matcher.describe();
+ }
+
+ template <typename RangeLike>
+ bool match(RangeLike&& rng) const {
+ for (auto&& elem : rng) {
+ if (m_matcher.match(elem)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+
+ // Creates a matcher that checks whether a range contains element matching a matcher
+ template <typename Matcher>
+ AllMatchMatcher<Matcher> AllMatch(Matcher&& matcher) {
+ return { std::forward<Matcher>(matcher) };
+ }
+
+ // Creates a matcher that checks whether no element in a range matches a matcher.
+ template <typename Matcher>
+ NoneMatchMatcher<Matcher> NoneMatch(Matcher&& matcher) {
+ return { std::forward<Matcher>(matcher) };
+ }
+
+ // Creates a matcher that checks whether any element in a range matches a matcher.
+ template <typename Matcher>
+ AnyMatchMatcher<Matcher> AnyMatch(Matcher&& matcher) {
+ return { std::forward<Matcher>(matcher) };
+ }
+ }
+}
+
+#endif // CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt
index 45e62ac5..4b51b804 100644
--- a/tests/SelfTest/Baselines/automake.sw.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.approved.txt
@@ -238,6 +238,7 @@ Message from section two
:test-result: FAIL Unexpected exceptions can be translated
:test-result: PASS Upcasting special member functions
: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 bbb50a93..a50cc6e3 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1668,6 +1668,24 @@ 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 2440a763..acd627ee 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: 351 | 277 passed | 70 failed | 4 failed as expected
-assertions: 1992 | 1840 passed | 131 failed | 21 failed as expected
+test cases: 352 | 278 passed | 70 failed | 4 failed as expected
+assertions: 2010 | 1858 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 d8a60b83..2dd42716 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -12287,6 +12287,129 @@ with expansion:
{?} has size == 13
-------------------------------------------------------------------------------
+Usage of the quantifiers matchers
+ Usage of the AllMatch range matcher
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, AllMatch(Contains(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 } } all match contains element 0
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, AllMatch(SizeIs(5)) )
+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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, AllMatch(StartsWith("C")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match starts with:
+ "C"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, AllMatch(EndsWith("+")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } all match ends with:
+ "+"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, AllMatch(!IsEmpty()) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match not is empty
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, AllMatch(SizeIs(2)) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } all match has size == 2
+
+-------------------------------------------------------------------------------
+Usage of the quantifiers matchers
+ Usage of the AnyMatch range matcher
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, AnyMatch(Contains(-2)) )
+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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, AnyMatch(SizeIs(5)) )
+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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, AnyMatch(StartsWith("CMak")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match starts with:
+ "CMak"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, AnyMatch(EndsWith("++")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } any match ends with:
+ "++"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, AnyMatch(Contains(4)) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match contains element 4
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, AnyMatch(SizeIs(2)) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } any match has size == 2
+
+-------------------------------------------------------------------------------
+Usage of the quantifiers matchers
+ Usage of the NoneMatch range matcher
+-------------------------------------------------------------------------------
+MatchersRanges.tests.cpp:<line number>
+...............................................................................
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, NoneMatch(Contains(-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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_arr_arr, NoneMatch(SizeIs(42)) )
+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
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, NoneMatch(StartsWith("abd")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match starts
+ with: "abd"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( string_vector, NoneMatch(EndsWith("#!--")) )
+with expansion:
+ { "Command+", "Catch2+", "CMake+", "C++", "Console+" } none match ends with:
+ "#!--"
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, NoneMatch(IsEmpty()) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match is empty
+
+MatchersRanges.tests.cpp:<line number>: PASSED:
+ REQUIRE_THAT( int_vectors_list, NoneMatch(SizeIs(3)) )
+with expansion:
+ { { 1, 2 }, { 3, 4 }, { 5, 6 } } none match has size == 3
+
+-------------------------------------------------------------------------------
Use a custom approx
-------------------------------------------------------------------------------
Approx.tests.cpp:<line number>
@@ -15681,6 +15804,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 351 | 261 passed | 86 failed | 4 failed as expected
-assertions: 2009 | 1840 passed | 148 failed | 21 failed as expected
+test cases: 352 | 262 passed | 86 failed | 4 failed as expected
+assertions: 2027 | 1858 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 21464c62..214e03e8 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="2010" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="2028" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
@@ -1283,6 +1283,9 @@ Exception.tests.cpp:<line number>
<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 96ebb9a0..ed78a3a9 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -1268,6 +1268,9 @@ Matchers.tests.cpp:<line number>
<testCase name="Usage of the SizeIs range matcher/Some with stdlib containers" duration="{duration}"/>
<testCase name="Usage of the SizeIs range matcher/Type requires ADL found size free function" duration="{duration}"/>
<testCase name="Usage of the SizeIs range matcher/Type has size member" duration="{duration}"/>
+ <testCase name="Usage of the quantifiers matchers/Usage of the AllMatch range matcher" duration="{duration}"/>
+ <testCase name="Usage of the quantifiers matchers/Usage of the AnyMatch range matcher" duration="{duration}"/>
+ <testCase name="Usage of the quantifiers matchers/Usage of the NoneMatch range matcher" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/UsageTests/Message.tests.cpp">
<testCase name="#1455 - INFO and WARN can start with a linebreak" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index c07c22bd..3b32341b 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -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
diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
index b9da3591..09b426b7 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
@@ -579,6 +579,8 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'
##teamcity[testFinished name='Upcasting special member functions' duration="{duration}"]
##teamcity[testStarted name='Usage of the SizeIs range matcher']
##teamcity[testFinished name='Usage of the SizeIs range matcher' duration="{duration}"]
+##teamcity[testStarted name='Usage of the quantifiers matchers']
+##teamcity[testFinished name='Usage of the quantifiers matchers' duration="{duration}"]
##teamcity[testStarted name='Use a custom approx']
##teamcity[testFinished name='Use a custom approx' duration="{duration}"]
##teamcity[testStarted name='Variadic macros']
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 928d2a70..a9de7c7e 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -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>
+ &l