mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Fix for comparing (const) char* to NULL
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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 );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user