Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorPhil Nash2012-02-10 08:30:13 +0000
committerPhil Nash2012-02-10 08:30:13 +0000
commita162e22fa3080faa7c3051677ef24a14b9f8daf4 (patch)
treec63e72a22cd308f29604a27dd707568410b60a3a /projects
parent6abf702895c5433f0790845b76eb6554d6cc7445 (diff)
downloadcatch3-a162e22fa3080faa7c3051677ef24a14b9f8daf4.tar.gz
Added CHECKED_IF and CHECKED_ELSE
Diffstat (limited to 'projects')
-rw-r--r--projects/SelfTest/MiscTests.cpp36
-rw-r--r--projects/SelfTest/TestMain.cpp4
2 files changed, 38 insertions, 2 deletions
diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp
index 0a4d1bb9..60a57350 100644
--- a/projects/SelfTest/MiscTests.cpp
+++ b/projects/SelfTest/MiscTests.cpp
@@ -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 ) );
+}
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 0ca760e5..868f0f60 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -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 );
}
}
}