diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 2c608188..4a6886d6 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -122,6 +122,7 @@ Nor would this :test-result: PASS Combining templated and concrete matchers :test-result: PASS Combining templated matchers :test-result: PASS Commas in various macros are allowed +:test-result: PASS Comparing (and stringifying) volatile pointers works :test-result: PASS Comparing function pointers :test-result: PASS Comparison ops :test-result: PASS Comparison with explicitly convertible types diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 6ee054f1..b0d30b87 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -120,6 +120,7 @@ :test-result: PASS Combining templated and concrete matchers :test-result: PASS Combining templated matchers :test-result: PASS Commas in various macros are allowed +:test-result: PASS Comparing (and stringifying) volatile pointers works :test-result: PASS Comparing function pointers :test-result: PASS Comparison ops :test-result: PASS Comparison with explicitly convertible types diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 477aa5ff..323da08e 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -483,6 +483,13 @@ Tricky.tests.cpp:: passed: std::vector{1, 2} == std::vector: passed: std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:: passed: true Tricky.tests.cpp:: passed: std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } +Misc.tests.cpp:: passed: !(ptr) for: !0 +Misc.tests.cpp:: passed: ptr == ptr for: 0 == 0 +Misc.tests.cpp:: passed: !(ptr != ptr) for: !(0 != 0) +Misc.tests.cpp:: passed: !(ptr < ptr) for: !(0 < 0) +Misc.tests.cpp:: passed: ptr <= ptr for: 0 <= 0 +Misc.tests.cpp:: passed: !(ptr > ptr) for: !(0 > 0) +Misc.tests.cpp:: passed: ptr >= ptr for: 0 >= 0 Tricky.tests.cpp:: passed: a for: 0x Tricky.tests.cpp:: passed: a == &foo for: 0x == 0x RandomNumberGeneration.tests.cpp:: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?} @@ -2877,7 +2884,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected -assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected +test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected +assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index d6b9f0c3..57b54ce1 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -481,6 +481,13 @@ Tricky.tests.cpp:: passed: std::vector{1, 2} == std::vector: passed: std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:: passed: true Tricky.tests.cpp:: passed: std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } +Misc.tests.cpp:: passed: !(ptr) for: !0 +Misc.tests.cpp:: passed: ptr == ptr for: 0 == 0 +Misc.tests.cpp:: passed: !(ptr != ptr) for: !(0 != 0) +Misc.tests.cpp:: passed: !(ptr < ptr) for: !(0 < 0) +Misc.tests.cpp:: passed: ptr <= ptr for: 0 <= 0 +Misc.tests.cpp:: passed: !(ptr > ptr) for: !(0 > 0) +Misc.tests.cpp:: passed: ptr >= ptr for: 0 >= 0 Tricky.tests.cpp:: passed: a for: 0x Tricky.tests.cpp:: passed: a == &foo for: 0x == 0x RandomNumberGeneration.tests.cpp:: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?} @@ -2866,7 +2873,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected -assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected +test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected +assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 3b6c86a0..c849d5ee 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1719,6 +1719,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 434 | 334 passed | 76 failed | 7 skipped | 17 failed as expected -assertions: 2271 | 2094 passed | 136 failed | 41 failed as expected +test cases: 435 | 335 passed | 76 failed | 7 skipped | 17 failed as expected +assertions: 2278 | 2101 passed | 136 failed | 41 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 7da948d1..394c4182 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -3555,6 +3555,47 @@ Tricky.tests.cpp:: PASSED: with expansion: { 1, 2 } == { 1, 2 } +------------------------------------------------------------------------------- +Comparing (and stringifying) volatile pointers works +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr ) +with expansion: + !0 + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr == ptr ) +with expansion: + 0 == 0 + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr != ptr ) +with expansion: + !(0 != 0) + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr < ptr ) +with expansion: + !(0 < 0) + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr <= ptr ) +with expansion: + 0 <= 0 + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr > ptr ) +with expansion: + !(0 > 0) + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr >= ptr ) +with expansion: + 0 >= 0 + ------------------------------------------------------------------------------- Comparing function pointers ------------------------------------------------------------------------------- @@ -19226,6 +19267,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected -assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected +test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected +assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 27247b0f..018864fe 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -3553,6 +3553,47 @@ Tricky.tests.cpp:: PASSED: with expansion: { 1, 2 } == { 1, 2 } +------------------------------------------------------------------------------- +Comparing (and stringifying) volatile pointers works +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr ) +with expansion: + !0 + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr == ptr ) +with expansion: + 0 == 0 + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr != ptr ) +with expansion: + !(0 != 0) + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr < ptr ) +with expansion: + !(0 < 0) + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr <= ptr ) +with expansion: + 0 <= 0 + +Misc.tests.cpp:: PASSED: + REQUIRE_FALSE( ptr > ptr ) +with expansion: + !(0 > 0) + +Misc.tests.cpp:: PASSED: + REQUIRE( ptr >= ptr ) +with expansion: + 0 >= 0 + ------------------------------------------------------------------------------- Comparing function pointers ------------------------------------------------------------------------------- @@ -19215,6 +19256,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected -assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected +test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected +assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 3c54c89c..42a98dd0 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -488,6 +488,7 @@ at Message.tests.cpp: + diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 8d3704c3..5f17b49d 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -487,6 +487,7 @@ at Message.tests.cpp: + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index c7026e37..9f1fbda6 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1934,6 +1934,7 @@ at Misc.tests.cpp: + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index a41578fc..ce9bd534 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -1933,6 +1933,7 @@ at Misc.tests.cpp: + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 340bbb1e..699d78c2 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -866,6 +866,20 @@ ok {test-number} - std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 ok {test-number} - true # Commas in various macros are allowed ok {test-number} - std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr) for: !0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr == ptr for: 0 == 0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr != ptr) for: !(0 != 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr < ptr) for: !(0 < 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr <= ptr for: 0 <= 0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr > ptr) for: !(0 > 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr >= ptr for: 0 >= 0 # Comparing function pointers ok {test-number} - a for: 0x # Comparing function pointers @@ -4605,5 +4619,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2304 +1..2311 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 132ad3de..6b18914c 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -864,6 +864,20 @@ ok {test-number} - std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 ok {test-number} - true # Commas in various macros are allowed ok {test-number} - std::vector{1, 2} == std::vector{1, 2} for: { 1, 2 } == { 1, 2 } +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr) for: !0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr == ptr for: 0 == 0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr != ptr) for: !(0 != 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr < ptr) for: !(0 < 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr <= ptr for: 0 <= 0 +# Comparing (and stringifying) volatile pointers works +ok {test-number} - !(ptr > ptr) for: !(0 > 0) +# Comparing (and stringifying) volatile pointers works +ok {test-number} - ptr >= ptr for: 0 >= 0 # Comparing function pointers ok {test-number} - a for: 0x # Comparing function pointers @@ -4594,5 +4608,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2304 +1..2311 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 52c56fb9..853f3d80 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -285,6 +285,8 @@ ##teamcity[testFinished name='Combining templated matchers' duration="{duration}"] ##teamcity[testStarted name='Commas in various macros are allowed'] ##teamcity[testFinished name='Commas in various macros are allowed' duration="{duration}"] +##teamcity[testStarted name='Comparing (and stringifying) volatile pointers works'] +##teamcity[testFinished name='Comparing (and stringifying) volatile pointers works' duration="{duration}"] ##teamcity[testStarted name='Comparing function pointers'] ##teamcity[testFinished name='Comparing function pointers' duration="{duration}"] ##teamcity[testStarted name='Comparison ops'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 28ee520b..10e318de 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -285,6 +285,8 @@ ##teamcity[testFinished name='Combining templated matchers' duration="{duration}"] ##teamcity[testStarted name='Commas in various macros are allowed'] ##teamcity[testFinished name='Commas in various macros are allowed' duration="{duration}"] +##teamcity[testStarted name='Comparing (and stringifying) volatile pointers works'] +##teamcity[testFinished name='Comparing (and stringifying) volatile pointers works' duration="{duration}"] ##teamcity[testStarted name='Comparing function pointers'] ##teamcity[testFinished name='Comparing function pointers' duration="{duration}"] ##teamcity[testStarted name='Comparison ops'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index fb0eff1a..48b0e260 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -3881,6 +3881,65 @@ C + + + + !(ptr) + + + !0 + + + + + ptr == ptr + + + 0 == 0 + + + + + !(ptr != ptr) + + + !(0 != 0) + + + + + !(ptr < ptr) + + + !(0 < 0) + + + + + ptr <= ptr + + + 0 <= 0 + + + + + !(ptr > ptr) + + + !(0 > 0) + + + + + ptr >= ptr + + + 0 >= 0 + + + + @@ -22227,6 +22286,6 @@ Approx( -1.95996398454005449 ) - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 39fe9c40..f0498aff 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -3881,6 +3881,65 @@ C + + + + !(ptr) + + + !0 + + + + + ptr == ptr + + + 0 == 0 + + + + + !(ptr != ptr) + + + !(0 != 0) + + + + + !(ptr < ptr) + + + !(0 < 0) + + + + + ptr <= ptr + + + 0 <= 0 + + + + + !(ptr > ptr) + + + !(0 > 0) + + + + + ptr >= ptr + + + 0 >= 0 + + + + @@ -22226,6 +22285,6 @@ Approx( -1.95996398454005449 ) - - + + diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index e43f2d84..dec51ab8 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -562,3 +562,15 @@ TEST_CASE("Validate SEH behavior - no crash for stack unwinding", "[approvals][! } #endif // _MSC_VER + +TEST_CASE( "Comparing (and stringifying) volatile pointers works", + "[volatile]" ) { + volatile int* ptr = nullptr; + REQUIRE_FALSE( ptr ); + REQUIRE( ptr == ptr ); + REQUIRE_FALSE( ptr != ptr ); + REQUIRE_FALSE( ptr < ptr ); + REQUIRE( ptr <= ptr ); + REQUIRE_FALSE( ptr > ptr ); + REQUIRE( ptr >= ptr ); +}