diff options
| author | Phil Nash | 2012-05-07 19:45:55 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-05-07 19:45:55 +0100 |
| commit | e1cb8f25f2c1da70f1a99ec842e20d83ea4340ff (patch) | |
| tree | 8abd9bc0cefb670195a9fbc509617795b9ef9095 /projects | |
| parent | a201f715a84c3f936e2442e40b4c7f3072d41326 (diff) | |
| download | catch3-e1cb8f25f2c1da70f1a99ec842e20d83ea4340ff.tar.gz | |
Fix for comparing (const) char* to NULL
Diffstat (limited to 'projects')
| -rw-r--r-- | projects/SelfTest/ConditionTests.cpp | 6 | ||||
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp index f14da68d..e9a8f685 100644 --- a/projects/SelfTest/ConditionTests.cpp +++ b/projects/SelfTest/ConditionTests.cpp @@ -221,6 +221,9 @@ TEST_CASE( "succeeding/conditions/negative ints", } #endif +inline const char* returnsConstNull(){ return NULL; } +inline char* returnsNull(){ return NULL; } + TEST_CASE( "./succeeding/conditions/ptr", "Pointers can be compared to null" ) { @@ -241,6 +244,9 @@ TEST_CASE( "./succeeding/conditions/ptr", const TestData* const cpc = p; REQUIRE( cpc != NULL ); + REQUIRE( returnsNull() == NULL ); + REQUIRE( returnsConstNull() == NULL ); + // REQUIRE( NULL != p ); // gives warning, but should compile and run ok } diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index a95402dc..48932dca 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -43,7 +43,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.getTotals().assertions.passed == 273 ); + CHECK( runner.getTotals().assertions.passed == 275 ); CHECK( runner.getTotals().assertions.failed == 0 ); } |