mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-05 22:18:16 +01:00
commit
b372dc6157
272 changed files with 22238 additions and 7949 deletions
|
|
@ -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(
|
||||
|
|
@ -497,6 +516,9 @@ TEST_CASE( "Floating point matchers: float", "[matchers][floating-point]" ) {
|
|||
REQUIRE_THROWS_AS( WithinRel( 1.f, -0.2f ), std::domain_error );
|
||||
REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error );
|
||||
}
|
||||
SECTION( "IsNaN" ) {
|
||||
REQUIRE_THAT( 1., !IsNaN() );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) {
|
||||
|
|
@ -552,6 +574,9 @@ TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) {
|
|||
REQUIRE_THROWS_AS( WithinRel( 1., -0.2 ), std::domain_error );
|
||||
REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error );
|
||||
}
|
||||
SECTION("IsNaN") {
|
||||
REQUIRE_THAT( 1., !IsNaN() );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE( "Floating point matchers that are problematic in approvals",
|
||||
|
|
@ -566,6 +591,8 @@ TEST_CASE( "Floating point matchers that are problematic in approvals",
|
|||
REQUIRE_THAT( NAN, !WithinRel( NAN ) );
|
||||
REQUIRE_THAT( 1., !WithinRel( NAN ) );
|
||||
REQUIRE_THAT( NAN, !WithinRel( 1. ) );
|
||||
REQUIRE_THAT( NAN, IsNaN() );
|
||||
REQUIRE_THAT( static_cast<double>(NAN), IsNaN() );
|
||||
}
|
||||
|
||||
TEST_CASE( "Arbitrary predicate matcher", "[matchers][generic]" ) {
|
||||
|
|
@ -660,6 +687,21 @@ TEST_CASE( "Exceptions matchers", "[matchers][exceptions][!throws]" ) {
|
|||
Message( "SpecialException::what" ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "Exception message can be matched", "[matchers][exceptions][!throws]" ) {
|
||||
REQUIRE_THROWS_MATCHES( throwsDerivedException(),
|
||||
DerivedException,
|
||||
MessageMatches( StartsWith( "Derived" ) ) );
|
||||
REQUIRE_THROWS_MATCHES( throwsDerivedException(),
|
||||
DerivedException,
|
||||
MessageMatches( EndsWith( "::what" ) ) );
|
||||
REQUIRE_THROWS_MATCHES( throwsDerivedException(),
|
||||
DerivedException,
|
||||
MessageMatches( !StartsWith( "::what" ) ) );
|
||||
REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ),
|
||||
SpecialException,
|
||||
MessageMatches( StartsWith( "Special" ) ) );
|
||||
}
|
||||
|
||||
struct CheckedTestingMatcher : Catch::Matchers::MatcherBase<int> {
|
||||
mutable bool matchCalled = false;
|
||||
bool matchSucceeds = false;
|
||||
|
|
@ -848,7 +890,7 @@ struct MatcherA : Catch::Matchers::MatcherGenericBase {
|
|||
return "equals: (int) 1 or (string) \"1\"";
|
||||
}
|
||||
bool match( int i ) const { return i == 1; }
|
||||
bool match( std::string s ) const { return s == "1"; }
|
||||
bool match( std::string const& s ) const { return s == "1"; }
|
||||
};
|
||||
|
||||
struct MatcherB : Catch::Matchers::MatcherGenericBase {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue