Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add NAN test for Approx

Commit
030321e3e0fc273f1c66d968f212414b0216a86d
Author
Martin Hořeňovský ·
Parents
5f961af70e5d

Files · Download .tar.gz

Changes

 projects/SelfTest/ApproxTests.cpp                    |  2 ++
 projects/SelfTest/Baselines/console.std.approved.txt |  2 +-
 projects/SelfTest/Baselines/console.sw.approved.txt  | 14 +++++++++++++-
 projects/SelfTest/Baselines/junit.sw.approved.txt    |  2 +-
 projects/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:<line number>:
+PASSED:
+  REQUIRE( NAN != Approx(NAN) )
+with expansion:
+  nanf != Approx( nan )
+
+ApproxTests.cpp:<line number>:
+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 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuitesloose text artifact
 >
-  <testsuite name="<exe-name>" errors="15" failures="85" tests="935" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="15" failures="85" tests="937" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
     <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
     <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
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 )
         </Expanded>
       </Expression>
+      <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ApproxTests.cpp" >
+        <Original>
+          NAN != Approx(NAN)
+        </Original>
+        <Expanded>
+          nanf != Approx( nan )
+        </Expanded>
+      </Expression>
+      <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/ApproxTests.cpp" >
+        <Original>
+          !(NAN == Approx(NAN))
+        </Original>
+        <Expanded>
+          !(nanf == Approx( nan ))
+        </Expanded>
+      </Expression>
       <OverallResult success="true"/>
     </TestCase>
     <TestCase name="Bitfields can be captured (#1027)" filename="projects/<exe-name>/TrickyTests.cpp" >
@@ -8718,7 +8734,7 @@ loose text artifact
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="814" failures="100" expectedFailures="21"/>
+    <OverallResults successes="816" failures="100" expectedFailures="21"/>
   </Group>
-  <OverallResults successes="814" failures="99" expectedFailures="21"/>
+  <OverallResults successes="816" failures="99" expectedFailures="21"/>
 </Catch>