diff options
| author | Phil Nash | 2011-03-18 14:39:58 +0000 |
|---|---|---|
| committer | Phil Nash | 2011-03-18 14:39:58 +0000 |
| commit | ef611c65d9d5e9144e2b4d09e40ff9f2edd656d0 (patch) | |
| tree | 878b9131c342b70fe4af3cf1f78a1c538ca1b35b /Test | |
| parent | 1e15669f2a84ecf47f76ea54610d5f362c072c2b (diff) | |
| download | catch3-ef611c65d9d5e9144e2b4d09e40ff9f2edd656d0.tar.gz | |
Pointer comparisons and compare to NULL
Diffstat (limited to 'Test')
| -rw-r--r-- | Test/ConditionTests.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Test/ConditionTests.cpp b/Test/ConditionTests.cpp index 136fe81f..5a2c5751 100644 --- a/Test/ConditionTests.cpp +++ b/Test/ConditionTests.cpp @@ -214,6 +214,19 @@ TEST_CASE( "./failing/conditions/unsigned-negative", "Comparisons between negati CHECK( negative == ui ); } +TEST_CASE( "./succeeding/conditions/ptr", "Pointers can be compared to null" ) +{ + TestData* p = NULL; + TestData* pNULL = NULL; + + REQUIRE( p == NULL ); + REQUIRE( p == pNULL ); + + TestData data; + p = &data; + REQUIRE( p != NULL ); +} + // Not (!) tests // The problem with the ! operator is that it has right-to-left associativity. // This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore, |