diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h index 8cb4c1d4..5613e774 100644 --- a/include/internal/catch_decomposer.h +++ b/include/internal/catch_decomposer.h @@ -80,14 +80,22 @@ namespace Catch { template auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; template + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; + template auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; + template + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; template auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast( lhs ) != rhs; }; template auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; template + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; + template auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; }; + template + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; }; template diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 50991312..11df0389 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1020,6 +1020,6 @@ with expansion: "{?}" == "1" =============================================================================== -test cases: 183 | 132 passed | 47 failed | 4 failed as expected -assertions: 882 | 765 passed | 96 failed | 21 failed as expected +test cases: 184 | 133 passed | 47 failed | 4 failed as expected +assertions: 884 | 767 passed | 96 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index ae2f6928..14fdcd9d 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -14,6 +14,25 @@ PASSED: with message: yay +------------------------------------------------------------------------------- +#1005: Comparing pointer to int and long (NULL can be either on various + systems) +------------------------------------------------------------------------------- +DecompositionTests.cpp: +............................................................................... + +DecompositionTests.cpp:: +PASSED: + REQUIRE( fptr == 0 ) +with expansion: + 0 == 0 + +DecompositionTests.cpp:: +PASSED: + REQUIRE( fptr == 0l ) +with expansion: + 0 == 0 + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -7535,6 +7554,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 183 | 129 passed | 50 failed | 4 failed as expected -assertions: 884 | 761 passed | 102 failed | 21 failed as expected +test cases: 184 | 130 passed | 50 failed | 4 failed as expected +assertions: 886 | 763 passed | 102 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index bdacd9cb..06c24e86 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -14,6 +14,25 @@ PASSED: with message: yay +------------------------------------------------------------------------------- +#1005: Comparing pointer to int and long (NULL can be either on various + systems) +------------------------------------------------------------------------------- +DecompositionTests.cpp: +............................................................................... + +DecompositionTests.cpp:: +PASSED: + REQUIRE( fptr == 0 ) +with expansion: + 0 == 0 + +DecompositionTests.cpp:: +PASSED: + REQUIRE( fptr == 0l ) +with expansion: + 0 == 0 + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -218,6 +237,6 @@ ConditionTests.cpp:: FAILED: CHECK_FALSE( true ) =============================================================================== -test cases: 8 | 5 passed | 1 failed | 2 failed as expected -assertions: 24 | 17 passed | 4 failed | 3 failed as expected +test cases: 9 | 6 passed | 1 failed | 2 failed as expected +assertions: 26 | 19 passed | 4 failed | 3 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index e49e19e4..15fa38f0 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,8 +1,9 @@ - + + expected exception diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 68607f0b..7f2b4b03 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -4,6 +4,25 @@ + + + + fptr == 0 + + + 0 == 0 + + + + + fptr == 0l + + + 0 == 0 + + + +
@@ -8287,7 +8306,7 @@ loose text artifact
- + - + diff --git a/projects/SelfTest/DecompositionTests.cpp b/projects/SelfTest/DecompositionTests.cpp index f2e04260..1b44b602 100644 --- a/projects/SelfTest/DecompositionTests.cpp +++ b/projects/SelfTest/DecompositionTests.cpp @@ -7,6 +7,7 @@ */ #include +#include struct truthy { truthy(bool b):m_value(b){} @@ -26,3 +27,9 @@ std::ostream& operator<<(std::ostream& o, truthy) { TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") { CHECK(truthy(false)); } + +TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition]") { + FILE* fptr = nullptr; + REQUIRE(fptr == 0); + REQUIRE(fptr == 0l); +}