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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-02-06 15:34:32 +0100
committerMartin Hořeňovský2023-02-06 15:34:38 +0100
commitcefa8fcf329c950493f80dcbf7e2870a20213e0f (patch)
treeb64ede4a721caa304d70979a8d5760a003dd7ad9 /tests/SelfTest/UsageTests
parent772fa3f7902b534d59e5fe4306e3cc6a255a6508 (diff)
downloadcatch3-cefa8fcf329c950493f80dcbf7e2870a20213e0f.tar.gz
Enable use of UnorderedRangeEquals with iterator+sentinel pairs
Diffstat (limited to 'tests/SelfTest/UsageTests')
-rw-r--r--tests/SelfTest/UsageTests/MatchersRanges.tests.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp
index 651e84e6..8b1420c9 100644
--- a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp
+++ b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp
@@ -634,6 +634,7 @@ TEST_CASE( "The quantifier range matchers support types with different types ret
TEST_CASE( "RangeEquals supports ranges with different types returned from begin and end",
"[matchers][templated][range][approvals] ") {
using Catch::Matchers::RangeEquals;
+ using Catch::Matchers::UnorderedRangeEquals;
has_different_begin_end_types<int> diff_types{ 1, 2, 3, 4, 5 };
std::array<int, 5> arr1{ { 1, 2, 3, 4, 5 } }, arr2{ { 2, 3, 4, 5, 6 } };
@@ -642,6 +643,7 @@ TEST_CASE( "RangeEquals supports ranges with different types returned from begin
REQUIRE_THAT( diff_types, RangeEquals( arr2, []( int l, int r ) {
return l + 1 == r;
} ) );
+ REQUIRE_THAT( diff_types, UnorderedRangeEquals( diff_types ) );
}
#endif
@@ -800,8 +802,14 @@ TEST_CASE( "Usage of UnorderedRangeEquals range matcher",
}
}
- // As above with RangeEquals, short cicuiting and other optimisations
- // are left to the STL implementation
+
+ SECTION( "Ranges that need ADL begin/end" ) {
+ unrelated::needs_ADL_begin<int> const
+ needs_adl1{ 1, 2, 3, 4, 5 },
+ needs_adl2{ 1, 2, 3, 4, 5 };
+
+ REQUIRE_THAT( needs_adl1, UnorderedRangeEquals( needs_adl2 ) );
+ }
}
/**