Add tests for comparing & stringifying volatile pointers

This commit is contained in:
Martin Hořeňovský
2025-08-08 00:02:33 +02:00
parent 9a3d68315b
commit 03c62cdf2e
18 changed files with 282 additions and 18 deletions

View File

@@ -122,6 +122,7 @@ Nor would this
:test-result: PASS Combining templated and concrete matchers :test-result: PASS Combining templated and concrete matchers
:test-result: PASS Combining templated matchers :test-result: PASS Combining templated matchers
:test-result: PASS Commas in various macros are allowed :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 Comparing function pointers
:test-result: PASS Comparison ops :test-result: PASS Comparison ops
:test-result: PASS Comparison with explicitly convertible types :test-result: PASS Comparison with explicitly convertible types

View File

@@ -120,6 +120,7 @@
:test-result: PASS Combining templated and concrete matchers :test-result: PASS Combining templated and concrete matchers
:test-result: PASS Combining templated matchers :test-result: PASS Combining templated matchers
:test-result: PASS Commas in various macros are allowed :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 Comparing function pointers
:test-result: PASS Comparison ops :test-result: PASS Comparison ops
:test-result: PASS Comparison with explicitly convertible types :test-result: PASS Comparison with explicitly convertible types

View File

@@ -483,6 +483,13 @@ Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<in
Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
Tricky.tests.cpp:<line number>: passed: true Tricky.tests.cpp:<line number>: passed: true
Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
Misc.tests.cpp:<line number>: passed: !(ptr) for: !0
Misc.tests.cpp:<line number>: passed: ptr == ptr for: 0 == 0
Misc.tests.cpp:<line number>: passed: !(ptr != ptr) for: !(0 != 0)
Misc.tests.cpp:<line number>: passed: !(ptr < ptr) for: !(0 < 0)
Misc.tests.cpp:<line number>: passed: ptr <= ptr for: 0 <= 0
Misc.tests.cpp:<line number>: passed: !(ptr > ptr) for: !(0 > 0)
Misc.tests.cpp:<line number>: passed: ptr >= ptr for: 0 >= 0
Tricky.tests.cpp:<line number>: passed: a for: 0x<hex digits> Tricky.tests.cpp:<line number>: passed: a for: 0x<hex digits>
Tricky.tests.cpp:<line number>: passed: a == &foo for: 0x<hex digits> == 0x<hex digits> Tricky.tests.cpp:<line number>: passed: a == &foo for: 0x<hex digits> == 0x<hex digits>
RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?} RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?}
@@ -2877,7 +2884,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected

View File

@@ -481,6 +481,13 @@ Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<in
Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
Tricky.tests.cpp:<line number>: passed: true Tricky.tests.cpp:<line number>: passed: true
Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
Misc.tests.cpp:<line number>: passed: !(ptr) for: !0
Misc.tests.cpp:<line number>: passed: ptr == ptr for: 0 == 0
Misc.tests.cpp:<line number>: passed: !(ptr != ptr) for: !(0 != 0)
Misc.tests.cpp:<line number>: passed: !(ptr < ptr) for: !(0 < 0)
Misc.tests.cpp:<line number>: passed: ptr <= ptr for: 0 <= 0
Misc.tests.cpp:<line number>: passed: !(ptr > ptr) for: !(0 > 0)
Misc.tests.cpp:<line number>: passed: ptr >= ptr for: 0 >= 0
Tricky.tests.cpp:<line number>: passed: a for: 0x<hex digits> Tricky.tests.cpp:<line number>: passed: a for: 0x<hex digits>
Tricky.tests.cpp:<line number>: passed: a == &foo for: 0x<hex digits> == 0x<hex digits> Tricky.tests.cpp:<line number>: passed: a == &foo for: 0x<hex digits> == 0x<hex digits>
RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?} RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?}
@@ -2866,7 +2873,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected

View File

@@ -1719,6 +1719,6 @@ due to unexpected exception with message:
Why would you throw a std::string? Why would you throw a std::string?
=============================================================================== ===============================================================================
test cases: 434 | 334 passed | 76 failed | 7 skipped | 17 failed as expected test cases: 435 | 335 passed | 76 failed | 7 skipped | 17 failed as expected
assertions: 2271 | 2094 passed | 136 failed | 41 failed as expected assertions: 2278 | 2101 passed | 136 failed | 41 failed as expected

View File

@@ -3555,6 +3555,47 @@ Tricky.tests.cpp:<line number>: PASSED:
with expansion: with expansion:
{ 1, 2 } == { 1, 2 } { 1, 2 } == { 1, 2 }
-------------------------------------------------------------------------------
Comparing (and stringifying) volatile pointers works
-------------------------------------------------------------------------------
Misc.tests.cpp:<line number>
...............................................................................
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr )
with expansion:
!0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr == ptr )
with expansion:
0 == 0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr != ptr )
with expansion:
!(0 != 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr < ptr )
with expansion:
!(0 < 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr <= ptr )
with expansion:
0 <= 0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr > ptr )
with expansion:
!(0 > 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr >= ptr )
with expansion:
0 >= 0
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Comparing function pointers Comparing function pointers
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@@ -19226,6 +19267,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED: Misc.tests.cpp:<line number>: PASSED:
=============================================================================== ===============================================================================
test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected

View File

@@ -3553,6 +3553,47 @@ Tricky.tests.cpp:<line number>: PASSED:
with expansion: with expansion:
{ 1, 2 } == { 1, 2 } { 1, 2 } == { 1, 2 }
-------------------------------------------------------------------------------
Comparing (and stringifying) volatile pointers works
-------------------------------------------------------------------------------
Misc.tests.cpp:<line number>
...............................................................................
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr )
with expansion:
!0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr == ptr )
with expansion:
0 == 0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr != ptr )
with expansion:
!(0 != 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr < ptr )
with expansion:
!(0 < 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr <= ptr )
with expansion:
0 <= 0
Misc.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( ptr > ptr )
with expansion:
!(0 > 0)
Misc.tests.cpp:<line number>: PASSED:
REQUIRE( ptr >= ptr )
with expansion:
0 >= 0
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Comparing function pointers Comparing function pointers
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@@ -19215,6 +19256,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED: Misc.tests.cpp:<line number>: PASSED:
=============================================================================== ===============================================================================
test cases: 434 | 316 passed | 95 failed | 6 skipped | 17 failed as expected test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2292 | 2094 passed | 157 failed | 41 failed as expected assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact <testsuitesloose text artifact
> >
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2304" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2311" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties> <properties>
<property name="random-seed" value="1"/> <property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/> <property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -488,6 +488,7 @@ at Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Combining templated and concrete matchers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Combining templated and concrete matchers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Combining templated matchers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Combining templated matchers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparing (and stringifying) volatile pointers works" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparison ops" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparison ops" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}" status="run"/>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites> <testsuites>
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2304" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2311" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties> <properties>
<property name="random-seed" value="1"/> <property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/> <property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -487,6 +487,7 @@ at Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Combining templated and concrete matchers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Combining templated and concrete matchers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Combining templated matchers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Combining templated matchers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparing (and stringifying) volatile pointers works" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparison ops" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparison ops" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}" status="run"/>

View File

@@ -1934,6 +1934,7 @@ at Misc.tests.cpp:<line number>
<testCase name="A couple of nested sections followed by a failure/Outer" duration="{duration}"/> <testCase name="A couple of nested sections followed by a failure/Outer" duration="{duration}"/>
<testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/> <testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/>
<testCase name="An empty test with no assertions" duration="{duration}"/> <testCase name="An empty test with no assertions" duration="{duration}"/>
<testCase name="Comparing (and stringifying) volatile pointers works" duration="{duration}"/>
<testCase name="Factorials are computed" duration="{duration}"/> <testCase name="Factorials are computed" duration="{duration}"/>
<testCase name="ManuallyRegistered" duration="{duration}"/> <testCase name="ManuallyRegistered" duration="{duration}"/>
<testCase name="Nice descriptive name" duration="{duration}"/> <testCase name="Nice descriptive name" duration="{duration}"/>

View File

@@ -1933,6 +1933,7 @@ at Misc.tests.cpp:<line number>
<testCase name="A couple of nested sections followed by a failure/Outer" duration="{duration}"/> <testCase name="A couple of nested sections followed by a failure/Outer" duration="{duration}"/>
<testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/> <testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/>
<testCase name="An empty test with no assertions" duration="{duration}"/> <testCase name="An empty test with no assertions" duration="{duration}"/>
<testCase name="Comparing (and stringifying) volatile pointers works" duration="{duration}"/>
<testCase name="Factorials are computed" duration="{duration}"/> <testCase name="Factorials are computed" duration="{duration}"/>
<testCase name="ManuallyRegistered" duration="{duration}"/> <testCase name="ManuallyRegistered" duration="{duration}"/>
<testCase name="Nice descriptive name" duration="{duration}"/> <testCase name="Nice descriptive name" duration="{duration}"/>

View File

@@ -866,6 +866,20 @@ ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2
ok {test-number} - true ok {test-number} - true
# Commas in various macros are allowed # Commas in various macros are allowed
ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{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 # Comparing function pointers
ok {test-number} - a for: 0x<hex digits> ok {test-number} - a for: 0x<hex digits>
# Comparing function pointers # Comparing function pointers
@@ -4605,5 +4619,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} - ok {test-number} -
# xmlentitycheck # xmlentitycheck
ok {test-number} - ok {test-number} -
1..2304 1..2311

View File

@@ -864,6 +864,20 @@ ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2
ok {test-number} - true ok {test-number} - true
# Commas in various macros are allowed # Commas in various macros are allowed
ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{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 # Comparing function pointers
ok {test-number} - a for: 0x<hex digits> ok {test-number} - a for: 0x<hex digits>
# Comparing function pointers # Comparing function pointers
@@ -4594,5 +4608,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} - ok {test-number} -
# xmlentitycheck # xmlentitycheck
ok {test-number} - ok {test-number} -
1..2304 1..2311

View File

@@ -285,6 +285,8 @@
##teamcity[testFinished name='Combining templated matchers' duration="{duration}"] ##teamcity[testFinished name='Combining templated matchers' duration="{duration}"]
##teamcity[testStarted name='Commas in various macros are allowed'] ##teamcity[testStarted name='Commas in various macros are allowed']
##teamcity[testFinished name='Commas in various macros are allowed' duration="{duration}"] ##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[testStarted name='Comparing function pointers']
##teamcity[testFinished name='Comparing function pointers' duration="{duration}"] ##teamcity[testFinished name='Comparing function pointers' duration="{duration}"]
##teamcity[testStarted name='Comparison ops'] ##teamcity[testStarted name='Comparison ops']

View File

@@ -285,6 +285,8 @@
##teamcity[testFinished name='Combining templated matchers' duration="{duration}"] ##teamcity[testFinished name='Combining templated matchers' duration="{duration}"]
##teamcity[testStarted name='Commas in various macros are allowed'] ##teamcity[testStarted name='Commas in various macros are allowed']
##teamcity[testFinished name='Commas in various macros are allowed' duration="{duration}"] ##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[testStarted name='Comparing function pointers']
##teamcity[testFinished name='Comparing function pointers' duration="{duration}"] ##teamcity[testFinished name='Comparing function pointers' duration="{duration}"]
##teamcity[testStarted name='Comparison ops'] ##teamcity[testStarted name='Comparison ops']

View File

@@ -3881,6 +3881,65 @@ C
</Expression> </Expression>
<OverallResult success="true" skips="0"/> <OverallResult success="true" skips="0"/>
</TestCase> </TestCase>
<TestCase name="Comparing (and stringifying) volatile pointers works" tags="[volatile]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr)
</Original>
<Expanded>
!0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr == ptr
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr != ptr)
</Original>
<Expanded>
!(0 != 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr &lt; ptr)
</Original>
<Expanded>
!(0 &lt; 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr &lt;= ptr
</Original>
<Expanded>
0 &lt;= 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr > ptr)
</Original>
<Expanded>
!(0 > 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr >= ptr
</Original>
<Expanded>
0 >= 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" >
<Original> <Original>
@@ -22227,6 +22286,6 @@ Approx( -1.95996398454005449 )
</Section> </Section>
<OverallResult success="true" skips="0"/> <OverallResult success="true" skips="0"/>
</TestCase> </TestCase>
<OverallResults successes="2094" failures="157" expectedFailures="41" skips="12"/> <OverallResults successes="2101" failures="157" expectedFailures="41" skips="12"/>
<OverallResultsCases successes="316" failures="95" expectedFailures="17" skips="6"/> <OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
</Catch2TestRun> </Catch2TestRun>

View File

@@ -3881,6 +3881,65 @@ C
</Expression> </Expression>
<OverallResult success="true" skips="0"/> <OverallResult success="true" skips="0"/>
</TestCase> </TestCase>
<TestCase name="Comparing (and stringifying) volatile pointers works" tags="[volatile]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr)
</Original>
<Expanded>
!0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr == ptr
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr != ptr)
</Original>
<Expanded>
!(0 != 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr &lt; ptr)
</Original>
<Expanded>
!(0 &lt; 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr &lt;= ptr
</Original>
<Expanded>
0 &lt;= 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
!(ptr > ptr)
</Original>
<Expanded>
!(0 > 0)
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
ptr >= ptr
</Original>
<Expanded>
0 >= 0
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" >
<Original> <Original>
@@ -22226,6 +22285,6 @@ Approx( -1.95996398454005449 )
</Section> </Section>
<OverallResult success="true" skips="0"/> <OverallResult success="true" skips="0"/>
</TestCase> </TestCase>
<OverallResults successes="2094" failures="157" expectedFailures="41" skips="12"/> <OverallResults successes="2101" failures="157" expectedFailures="41" skips="12"/>
<OverallResultsCases successes="316" failures="95" expectedFailures="17" skips="6"/> <OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
</Catch2TestRun> </Catch2TestRun>

View File

@@ -562,3 +562,15 @@ TEST_CASE("Validate SEH behavior - no crash for stack unwinding", "[approvals][!
} }
#endif // _MSC_VER #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 );
}