diff options
| author | Phil Nash | 2012-10-28 20:57:21 +0000 |
|---|---|---|
| committer | Phil Nash | 2012-10-28 20:57:21 +0000 |
| commit | 134e45b3ade922e5cbdb2df6b81830fbd93fe448 (patch) | |
| tree | 2eb7043e1463122e721b44115e607686a30cd0e1 /projects | |
| parent | 2f92db9898978ca1ee27c964d8a51fa507391935 (diff) | |
| download | catch3-134e45b3ade922e5cbdb2df6b81830fbd93fe448.tar.gz | |
Fixed #132
Diffstat (limited to 'projects')
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 2 | ||||
| -rw-r--r-- | projects/SelfTest/TrickyTests.cpp | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index b0fe11f5..6e38d44c 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -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 ); } diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 50e6a394..f15d236c 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -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 ); +} |