diff options
| author | Martin Hořeňovský | 2023-03-05 00:11:07 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-03-05 00:11:38 +0100 |
| commit | 0a0ebf50034831718ffc63c6d12abb1fa469d6e9 (patch) | |
| tree | f4635427c6bc9ef08094852827a20d92f398588b /tests/SelfTest/UsageTests | |
| parent | 69f35a5ac8ee4cb60dce7afe6978f10871baa718 (diff) | |
| download | catch3-0a0ebf50034831718ffc63c6d12abb1fa469d6e9.tar.gz | |
Support elements without op!= in VectorEquals
Closes #2648
Diffstat (limited to 'tests/SelfTest/UsageTests')
| -rw-r--r-- | tests/SelfTest/UsageTests/Matchers.tests.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index 49e25232..a40908d7 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -406,6 +406,25 @@ TEST_CASE( "Vector matchers that fail", "[matchers][vector][.][failing]" ) { } } +namespace { + struct SomeType { + int i; + friend bool operator==( SomeType lhs, SomeType rhs ) { + return lhs.i == rhs.i; + } + }; +} // end anonymous namespace + +TEST_CASE( "Vector matcher with elements without !=", "[matchers][vector][approvals]" ) { + std::vector<SomeType> lhs, rhs; + lhs.push_back( { 1 } ); + lhs.push_back( { 2 } ); + rhs.push_back( { 1 } ); + rhs.push_back( { 1 } ); + + REQUIRE_THAT( lhs, !Equals(rhs) ); +} + TEST_CASE( "Exception matchers that succeed", "[matchers][exceptions][!throws]" ) { CHECK_THROWS_MATCHES( |