mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added CHECKED_IF and CHECKED_ELSE
This commit is contained in:
@@ -121,3 +121,39 @@ TEST_CASE( "./failing/info", "sends information to INFO" )
|
||||
CAPTURE( i );
|
||||
REQUIRE( false );
|
||||
}
|
||||
|
||||
inline bool testCheckedIf( bool flag )
|
||||
{
|
||||
CHECKED_IF( flag )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_CASE( "./succeeding/checkedif", "" )
|
||||
{
|
||||
REQUIRE( testCheckedIf( true ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "./failing/checkedif", "" )
|
||||
{
|
||||
REQUIRE( testCheckedIf( false ) );
|
||||
}
|
||||
|
||||
inline bool testCheckedElse( bool flag )
|
||||
{
|
||||
CHECKED_ELSE( flag )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_CASE( "./succeeding/checkedelse", "" )
|
||||
{
|
||||
REQUIRE( testCheckedElse( true ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "./failing/checkedelse", "" )
|
||||
{
|
||||
REQUIRE( testCheckedElse( false ) );
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
||||
"Number of 'succeeding' tests is fixed" )
|
||||
{
|
||||
runner.runMatching( "./succeeding/*" );
|
||||
CHECK( runner.getSuccessCount() == 258 );
|
||||
CHECK( runner.getSuccessCount() == 262 );
|
||||
CHECK( runner.getFailureCount() == 0 );
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
||||
{
|
||||
runner.runMatching( "./failing/*" );
|
||||
CHECK( runner.getSuccessCount() == 0 );
|
||||
CHECK( runner.getFailureCount() == 64 );
|
||||
CHECK( runner.getFailureCount() == 68 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user