This commit is contained in:
Phil Nash
2012-10-28 20:57:21 +00:00
parent 2f92db9898
commit 134e45b3ad
4 changed files with 39 additions and 24 deletions

View File

@@ -37,7 +37,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
SECTION( "selftest/test counts/succeeding tests",
"Number of 'succeeding' tests is fixed" ) {
Totals totals = runner.runMatching( "./succeeding/*" );
CHECK( totals.assertions.passed == 285 );
CHECK( totals.assertions.passed == 288 );
CHECK( totals.assertions.failed == 0 );
}

View File

@@ -293,3 +293,24 @@ TEST_CASE( "./sameName", "Tests with the same name are not allowed" )
}
*/
struct Boolable
{
explicit Boolable( bool value ) : m_value( value ) {}
operator Catch::SafeBool::type() const {
return Catch::SafeBool::makeSafe( m_value );
}
bool m_value;
};
TEST_CASE( "./succeeding/SafeBool", "Objects that evaluated in boolean contexts can be checked")
{
Boolable True( true );
Boolable False( false );
CHECK( True );
CHECK( !False );
CHECK_FALSE( False );
}