diff options
| author | Martin Hořeňovský | 2023-02-26 00:14:32 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-02-26 00:14:32 +0100 |
| commit | 6fbb3f07235311d0c228b17b52406343a7aed8f2 (patch) | |
| tree | 9c1d0397f24cef4b8db3b27e85beea113ec8773a /tests/SelfTest | |
| parent | 9ff3cde87b1d8c61d2d97c34bdc71f0ec0a34a9c (diff) | |
| download | catch3-6fbb3f07235311d0c228b17b52406343a7aed8f2.tar.gz | |
Add IsNaN matcher
Diffstat (limited to 'tests/SelfTest')
14 files changed, 131 insertions, 11 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 1f1622c7..541770cc 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -629,6 +629,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other @@ -661,6 +662,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, static_cast<uint64_t>( Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 0.f ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, -0.2f ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 1.f ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 @@ -2537,6 +2539,6 @@ 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: test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected -assertions: 2224 | 2047 passed | 145 failed | 32 failed as expected +assertions: 2226 | 2049 passed | 145 failed | 32 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 4cfcb1ab..5b292da1 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -627,6 +627,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other @@ -659,6 +660,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, static_cast<uint64_t>( Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 0.f ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, -0.2f ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 1.f ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 @@ -2526,6 +2528,6 @@ 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: test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected -assertions: 2224 | 2047 passed | 145 failed | 32 failed as expected +assertions: 2226 | 2049 passed | 145 failed | 32 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 46df088e..15d8b024 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1534,5 +1534,5 @@ due to unexpected exception with message: =============================================================================== test cases: 409 | 323 passed | 69 failed | 6 skipped | 11 failed as expected -assertions: 2207 | 2047 passed | 128 failed | 32 failed as expected +assertions: 2209 | 2049 passed | 128 failed | 32 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index fcd9626f..26d5e8f3 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -4672,6 +4672,18 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ) ------------------------------------------------------------------------------- +Floating point matchers: double + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + +------------------------------------------------------------------------------- Floating point matchers: float Relative ------------------------------------------------------------------------------- @@ -4865,6 +4877,18 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ) ------------------------------------------------------------------------------- +Floating point matchers: float + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + +------------------------------------------------------------------------------- Generators -- adapters Filtering by predicate Basic usage @@ -18208,5 +18232,5 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected -assertions: 2224 | 2047 passed | 145 failed | 32 failed as expected +assertions: 2226 | 2049 passed | 145 failed | 32 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 1e9c0677..80b63ab8 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -4670,6 +4670,18 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ) ------------------------------------------------------------------------------- +Floating point matchers: double + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + +------------------------------------------------------------------------------- Floating point matchers: float Relative ------------------------------------------------------------------------------- @@ -4863,6 +4875,18 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ) ------------------------------------------------------------------------------- +Floating point matchers: float + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + +------------------------------------------------------------------------------- Generators -- adapters Filtering by predicate Basic usage @@ -18197,5 +18221,5 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected -assertions: 2224 | 2047 passed | 145 failed | 32 failed as expected +assertions: 2226 | 2049 passed | 145 failed | 32 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 58762161..25129349 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2235" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2237" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -694,12 +694,14 @@ at Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Basic usage" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Shortening a range" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 1da7a257..6220d8e2 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuites> - <testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2235" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2237" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -693,12 +693,14 @@ at Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Basic usage" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Shortening a range" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 4d1dcf2f..a4e08bd2 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1172,12 +1172,14 @@ at Matchers.tests.cpp:<line number> <testCase name="Floating point matchers: double/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: double/Composed" duration="{duration}"/> <testCase name="Floating point matchers: double/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: double/IsNaN" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative/Some subnormal values" duration="{duration}"/> <testCase name="Floating point matchers: float/Margin" duration="{duration}"/> <testCase name="Floating point matchers: float/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: float/Composed" duration="{duration}"/> <testCase name="Floating point matchers: float/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: float/IsNaN" duration="{duration}"/> <testCase name="Matchers can be (AllOf) composed with the && operator" duration="{duration}"/> <testCase name="Matchers can be (AnyOf) composed with the || operator" duration="{duration}"/> <testCase name="Matchers can be composed with both && and ||" duration="{duration}"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 84ca07d6..c00defae 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -1171,12 +1171,14 @@ at Matchers.tests.cpp:<line number> <testCase name="Floating point matchers: double/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: double/Composed" duration="{duration}"/> <testCase name="Floating point matchers: double/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: double/IsNaN" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative/Some subnormal values" duration="{duration}"/> <testCase name="Floating point matchers: float/Margin" duration="{duration}"/> <testCase name="Floating point matchers: float/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: float/Composed" duration="{duration}"/> <testCase name="Floating point matchers: float/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: float/IsNaN" duration="{duration}"/> <testCase name="Matchers can be (AllOf) composed with the && operator" duration="{duration}"/> <testCase name="Matchers can be (AnyOf) composed with the || operator" duration="{duration}"/> <testCase name="Matchers can be composed with both && and ||" duration="{duration}"/> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 16728b46..920c95fd 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1190,6 +1190,8 @@ ok {test-number} - WithinRel( 1., 0. ) ok {test-number} - WithinRel( 1., -0.2 ), std::domain_error # Floating point matchers: double ok {test-number} - WithinRel( 1., 1. ), std::domain_error +# Floating point matchers: double +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Floating point matchers: float ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other # Floating point matchers: float @@ -1254,6 +1256,8 @@ ok {test-number} - WithinRel( 1.f, 0.f ) ok {test-number} - WithinRel( 1.f, -0.2f ), std::domain_error # Floating point matchers: float ok {test-number} - WithinRel( 1.f, 1.f ), std::domain_error +# Floating point matchers: float +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Generators -- adapters ok {test-number} - i % 2 == 0 for: 0 == 0 # Generators -- adapters @@ -4473,5 +4477,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2235 +1..2237 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 44d078f7..c0e0c4db 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -1188,6 +1188,8 @@ ok {test-number} - WithinRel( 1., 0. ) ok {test-number} - WithinRel( 1., -0.2 ), std::domain_error # Floating point matchers: double ok {test-number} - WithinRel( 1., 1. ), std::domain_error +# Floating point matchers: double +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Floating point matchers: float ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other # Floating point matchers: float @@ -1252,6 +1254,8 @@ ok {test-number} - WithinRel( 1.f, 0.f ) ok {test-number} - WithinRel( 1.f, -0.2f ), std::domain_error # Floating point matchers: float ok {test-number} - WithinRel( 1.f, 1.f ), std::domain_error +# Floating point matchers: float +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Generators -- adapters ok {test-number} - i % 2 == 0 for: 0 == 0 # Generators -- adapters @@ -4462,5 +4466,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2235 +1..2237 diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 97aa7d85..6a0d1587 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -5287,6 +5287,17 @@ C </Expression> <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5564,6 +5575,17 @@ C </Expression> <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- adapters" tags="[generators][generic]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -21181,6 +21203,6 @@ b1! </Section> <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2047" failures="145" expectedFailures="32" skips="11"/> + <OverallResults successes="2049" failures="145" expectedFailures="32" skips="11"/> <OverallResultsCases successes="309" failures="84" expectedFailures="11" skips="5"/> </Catch2TestRun> diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index aed70cfa..c6ddfc80 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -5287,6 +5287,17 @@ C </Expression> <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5564,6 +5575,17 @@ C </Expression> <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- adapters" tags="[generators][generic]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -21180,6 +21202,6 @@ b1! </Section> <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2047" failures="145" expectedFailures="32" skips="11"/> + <OverallResults successes="2049" failures="145" expectedFailures="32" skips="11"/> <OverallResultsCases successes="309" failures="84" expectedFailures="11" skips="5"/> </Catch2TestRun> diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index b2239572..49e25232 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -497,6 +497,9 @@ TEST_CASE( "Floating point matchers: float", "[matchers][floating-point]" ) { REQUIRE_THROWS_AS( WithinRel( 1.f, -0.2f ), std::domain_error ); REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ); } + SECTION( "IsNaN" ) { + REQUIRE_THAT( 1., !IsNaN() ); + } } TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) { @@ -552,6 +555,9 @@ TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) { REQUIRE_THROWS_AS( WithinRel( 1., -0.2 ), std::domain_error ); REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ); } + SECTION("IsNaN") { + REQUIRE_THAT( 1., !IsNaN() ); + } } TEST_CASE( "Floating point matchers that are problematic in approvals", @@ -566,6 +572,8 @@ TEST_CASE( "Floating point matchers that are problematic in approvals", REQUIRE_THAT( NAN, !WithinRel( NAN ) ); REQUIRE_THAT( 1., !WithinRel( NAN ) ); REQUIRE_THAT( NAN, !WithinRel( 1. ) ); + REQUIRE_THAT( NAN, IsNaN() ); + REQUIRE_THAT( static_cast<double>(NAN), IsNaN() ); } TEST_CASE( "Arbitrary predicate matcher", "[matchers][generic]" ) { |