From 030321e3e0fc273f1c66d968f212414b0216a86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 10 Nov 2017 18:48:45 +0100 Subject: [PATCH] Add NAN test for Approx --- projects/SelfTest/ApproxTests.cpp | 2 ++ .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 14 ++++++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 20 +++++++++++++++++-- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/projects/SelfTest/ApproxTests.cpp b/projects/SelfTest/ApproxTests.cpp index 09008e5a..b8207617 100644 --- a/projects/SelfTest/ApproxTests.cpp +++ b/projects/SelfTest/ApproxTests.cpp @@ -190,6 +190,8 @@ TEST_CASE("Epsilon only applies to Approx's value", "[Approx]") { TEST_CASE("Assorted miscellaneous tests", "[Approx]") { REQUIRE(INFINITY == Approx(INFINITY)); + REQUIRE(NAN != Approx(NAN)); + REQUIRE_FALSE(NAN == Approx(NAN)); } class StrongDoubleTypedef diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index f944b6ad..5c22d98c 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1004,5 +1004,5 @@ with expansion: =============================================================================== test cases: 187 | 136 passed | 47 failed | 4 failed as expected -assertions: 935 | 818 passed | 96 failed | 21 failed as expected +assertions: 937 | 820 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 ead39b33..9ba153b6 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -826,6 +826,18 @@ PASSED: with expansion: inff == Approx( inf ) +ApproxTests.cpp:: +PASSED: + REQUIRE( NAN != Approx(NAN) ) +with expansion: + nanf != Approx( nan ) + +ApproxTests.cpp:: +PASSED: + REQUIRE_FALSE( NAN == Approx(NAN) ) +with expansion: + !(nanf == Approx( nan )) + ------------------------------------------------------------------------------- Bitfields can be captured (#1027) ------------------------------------------------------------------------------- @@ -7861,5 +7873,5 @@ PASSED: =============================================================================== test cases: 187 | 134 passed | 49 failed | 4 failed as expected -assertions: 934 | 814 passed | 99 failed | 21 failed as expected +assertions: 936 | 816 passed | 99 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index a58c16ea..1fa52a6b 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index f8abb183..89531ae0 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -869,6 +869,22 @@ inff == Approx( inf ) + + + NAN != Approx(NAN) + + + nanf != Approx( nan ) + + + + + !(NAN == Approx(NAN)) + + + !(nanf == Approx( nan )) + + @@ -8718,7 +8734,7 @@ loose text artifact - + - +