Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-04 13:23:14 +0200
committerMartin Hořeňovský2019-10-04 13:28:43 +0200
commit02ee130bd0191b084821ccfa2dfd7eba9df197aa (patch)
treeec15e2e71ccc12cf54dd48b1070e3b92fce24bb6 /projects
parent815f99541dc352c4adbb2f8474f7f67108a830d2 (diff)
downloadcatch3-02ee130bd0191b084821ccfa2dfd7eba9df197aa.tar.gz
Special case Approx(inf) to better follow user expectations
Diffstat (limited to 'projects')
-rw-r--r--projects/SelfTest/Baselines/compact.sw.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/console.sw.approved.txt30
-rw-r--r--projects/SelfTest/Baselines/junit.sw.approved.txt3
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt39
-rw-r--r--projects/SelfTest/UsageTests/Approx.tests.cpp6
6 files changed, 10 insertions, 76 deletions
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
index 03b49599..7c93c160 100644
--- a/projects/SelfTest/Baselines/compact.sw.approved.txt
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -243,9 +243,6 @@ Tricky.tests.cpp:<line number>: passed: true
Tricky.tests.cpp:<line number>: passed: true
Tricky.tests.cpp:<line number>: passed: true
Tricky.tests.cpp:<line number>: passed: true
-Approx.tests.cpp:<line number>: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf )
-Approx.tests.cpp:<line number>: passed: NAN != Approx(NAN) for: nanf != Approx( nan )
-Approx.tests.cpp:<line number>: passed: !(NAN == Approx(NAN)) for: !(nanf == Approx( nan ))
Message.tests.cpp:<line number>: passed: with 7 messages: 'a := 1' and 'b := 2' and 'c := 3' and 'a + b := 3' and 'a+b := 3' and 'c > b := true' and 'a == 1 := true'
Message.tests.cpp:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2, 3}[0, 1, 2] := 3' and 'std::vector<int>{1, 2, 3}[(0, 1)] := 2' and 'std::vector<int>{1, 2, 3}[0] := 1' and '(helper_1436<int, int>{12, -12}) := { 12, -12 }' and '(helper_1436<int, int>(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3'
Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{''
@@ -993,7 +990,6 @@ Approx.tests.cpp:<line number>: passed: d != 1.22_a for: 1.23 != Approx( 1.22 )
Approx.tests.cpp:<line number>: passed: Approx( d ) == 1.23 for: Approx( 1.23 ) == 1.23
Approx.tests.cpp:<line number>: passed: Approx( d ) != 1.22 for: Approx( 1.23 ) != 1.22
Approx.tests.cpp:<line number>: passed: Approx( d ) != 1.24 for: Approx( 1.23 ) != 1.24
-Approx.tests.cpp:<line number>: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf )
Message from section one
Message from section two
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), StartsWith("This String") for: "this string contains 'abc' as a substring" starts with: "This String"
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index 5798dcbe..a729420d 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
-test cases: 301 | 227 passed | 70 failed | 4 failed as expected
-assertions: 1569 | 1417 passed | 131 failed | 21 failed as expected
+test cases: 300 | 226 passed | 70 failed | 4 failed as expected
+assertions: 1565 | 1413 passed | 131 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index b4aba834..83ca294e 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -1940,27 +1940,6 @@ Tricky.tests.cpp:<line number>: PASSED:
REQUIRE( true )
-------------------------------------------------------------------------------
-Assorted miscellaneous tests
--------------------------------------------------------------------------------
-Approx.tests.cpp:<line number>
-...............................................................................
-
-Approx.tests.cpp:<line number>: PASSED:
- REQUIRE( INFINITY == Approx(INFINITY) )
-with expansion:
- inff == Approx( inf )
-
-Approx.tests.cpp:<line number>: PASSED:
- REQUIRE( NAN != Approx(NAN) )
-with expansion:
- nanf != Approx( nan )
-
-Approx.tests.cpp:<line number>: PASSED:
- REQUIRE_FALSE( NAN == Approx(NAN) )
-with expansion:
- !(nanf == Approx( nan ))
-
--------------------------------------------------------------------------------
CAPTURE can deal with complex expressions
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
@@ -7418,11 +7397,6 @@ Approx.tests.cpp:<line number>: PASSED:
with expansion:
Approx( 1.23 ) != 1.24
-Approx.tests.cpp:<line number>: PASSED:
- REQUIRE( INFINITY == Approx(INFINITY) )
-with expansion:
- inff == Approx( inf )
-
Message from section one
-------------------------------------------------------------------------------
Standard output from all sections is reported
@@ -12528,6 +12502,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 301 | 211 passed | 86 failed | 4 failed as expected
-assertions: 1586 | 1417 passed | 148 failed | 21 failed as expected
+test cases: 300 | 210 passed | 86 failed | 4 failed as expected
+assertions: 1582 | 1413 passed | 148 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index a768f1e6..ae12fb07 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="17" failures="132" tests="1587" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1583" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
<property name="random-seed" value="1"/>
@@ -232,7 +232,6 @@ Exception.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Assertions then sections/A section" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another section" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}"/>
- <testcase classname="<exe-name>.global" name="Assorted miscellaneous tests" time="{duration}"/>
<testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions" time="{duration}"/>
<testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions involving commas" time="{duration}"/>
<testcase classname="<exe-name>.global" name="CAPTURE parses string and character constants" time="{duration}"/>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index c4e5a75e..06d15a4e 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -2172,33 +2172,6 @@ Nor would this
</Section>
<OverallResult success="true"/>
</TestCase>
- <TestCase name="Assorted miscellaneous tests" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
- <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
- <Original>
- INFINITY == Approx(INFINITY)
- </Original>
- <Expanded>
- inff == Approx( inf )
- </Expanded>
- </Expression>
- <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
- <Original>
- NAN != Approx(NAN)
- </Original>
- <Expanded>
- nanf != Approx( nan )
- </Expanded>
- </Expression>
- <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
- <Original>
- !(NAN == Approx(NAN))
- </Original>
- <Expanded>
- !(nanf == Approx( nan ))
- </Expanded>
- </Expression>
- <OverallResult success="true"/>
- </TestCase>
<TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
a := 1
@@ -9168,14 +9141,6 @@ A string sent to stderr via clog
Approx( 1.23 ) != 1.24
</Expanded>
</Expression>
- <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
- <Original>
- INFINITY == Approx(INFINITY)
- </Original>
- <Expanded>
- inff == Approx( inf )
- </Expanded>
- </Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
@@ -14915,7 +14880,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1417" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1413" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1417" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1413" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/projects/SelfTest/UsageTests/Approx.tests.cpp b/projects/SelfTest/UsageTests/Approx.tests.cpp
index b95394a0..b51e3ccb 100644
--- a/projects/SelfTest/UsageTests/Approx.tests.cpp
+++ b/projects/SelfTest/UsageTests/Approx.tests.cpp
@@ -61,8 +61,6 @@ TEST_CASE( "Some simple comparisons between doubles", "[Approx]" ) {
REQUIRE( Approx( d ) == 1.23 );
REQUIRE( Approx( d ) != 1.22 );
REQUIRE( Approx( d ) != 1.24 );
-
- REQUIRE(INFINITY == Approx(INFINITY));
}
///////////////////////////////////////////////////////////////////////////////
@@ -183,8 +181,10 @@ TEST_CASE("Epsilon only applies to Approx's value", "[Approx]") {
REQUIRE(101.01 != Approx(100).epsilon(0.01));
}
-TEST_CASE("Assorted miscellaneous tests", "[Approx]") {
+TEST_CASE("Assorted miscellaneous tests", "[Approx][approvals]") {
REQUIRE(INFINITY == Approx(INFINITY));
+ REQUIRE(-INFINITY != Approx(INFINITY));
+ REQUIRE(1 != Approx(INFINITY));
REQUIRE(NAN != Approx(NAN));
REQUIRE_FALSE(NAN == Approx(NAN));
}