Use CATCH_NULL instead of NULL

- expands to nullptr if CATCH_CONFIG_CPP11_NULLPTR is defined (see #444)
This commit is contained in:
Phil Nash 2015-07-01 07:33:27 +01:00
parent 3b18d9e962
commit 805de43a3d
25 changed files with 112 additions and 101 deletions

View file

@ -265,32 +265,32 @@ TEST_CASE( "Comparisons between ints where one side is computed", "" )
#pragma GCC diagnostic pop
#endif
inline const char* returnsConstNull(){ return NULL; }
inline char* returnsNull(){ return NULL; }
inline const char* returnsConstNull(){ return CATCH_NULL; }
inline char* returnsNull(){ return CATCH_NULL; }
TEST_CASE( "Pointers can be compared to null", "" )
{
TestData* p = NULL;
TestData* pNULL = NULL;
TestData* p = CATCH_NULL;
TestData* pNULL = CATCH_NULL;
REQUIRE( p == NULL );
REQUIRE( p == CATCH_NULL );
REQUIRE( p == pNULL );
TestData data;
p = &data;
REQUIRE( p != NULL );
REQUIRE( p != CATCH_NULL );
const TestData* cp = p;
REQUIRE( cp != NULL );
REQUIRE( cp != CATCH_NULL );
const TestData* const cpc = p;
REQUIRE( cpc != NULL );
REQUIRE( cpc != CATCH_NULL );
REQUIRE( returnsNull() == NULL );
REQUIRE( returnsConstNull() == NULL );
REQUIRE( returnsNull() == CATCH_NULL );
REQUIRE( returnsConstNull() == CATCH_NULL );
REQUIRE( NULL != p );
REQUIRE( CATCH_NULL != p );
}
// Not (!) tests