diff options
| author | Martin Hořeňovský | 2026-07-23 14:26:17 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-07-23 14:26:26 +0200 |
| commit | c267251e709c52cda421e9490c5cbaf62914fa52 (patch) | |
| tree | a1330c2158cd39ac376d05fca0960a58cda679d7 /tests | |
| parent | 0cc833ea95bb7136c99be1b5b105780cae5766ff (diff) | |
| download | catch3-c267251e709c52cda421e9490c5cbaf62914fa52.tar.gz | |
Better support for infs and NaNs in JSON writer
As the types and values sent into the writer are determined by Catch2,
I do not expect to actually need this support, but it is better to have
it and not be surprised in the future.
Diffstat (limited to 'tests')
18 files changed, 411 insertions, 18 deletions
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index b0028998..a25bc52a 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -190,6 +190,8 @@ Nor would this :test-result: PASS Inequality checks that should succeed :test-result: PASS JsonWriter :test-result: PASS JsonWriter escapes characters in strings properly +:test-result: PASS JsonWriter serializes non-finite FP using Python spelling - double +:test-result: PASS JsonWriter serializes non-finite FP using Python spelling - float :test-result: PASS JsonWriter serializes numbers independently of the global locale :test-result: PASS Lambdas in assertions :test-result: PASS Less-than inequalities with different epsilons diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 9602395a..3f846b7b 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -188,6 +188,8 @@ :test-result: PASS Inequality checks that should succeed :test-result: PASS JsonWriter :test-result: PASS JsonWriter escapes characters in strings properly +:test-result: PASS JsonWriter serializes non-finite FP using Python spelling - double +:test-result: PASS JsonWriter serializes non-finite FP using Python spelling - float :test-result: PASS JsonWriter serializes numbers independently of the global locale :test-result: PASS Lambdas in assertions :test-result: PASS Less-than inequalities with different epsilons diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index d669bce4..7989d276 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1248,6 +1248,12 @@ Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\n\"" for: ""\n"" == Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\r\"" for: ""\r"" == ""\r"" Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\t\"" for: ""\t"" == ""\t"" Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\\\/\\t\\r\\n\"" for: ""\\/\t\r\n"" == ""\\/\t\r\n"" +Json.tests.cpp:<line number>: passed: sstream.str() == "NaN" for: "NaN" == "NaN" +Json.tests.cpp:<line number>: passed: sstream.str() == "Infinity" for: "Infinity" == "Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "NaN" for: "NaN" == "NaN" +Json.tests.cpp:<line number>: passed: sstream.str() == "Infinity" for: "Infinity" == "Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" Json.tests.cpp:<line number>: passed: sstream.str(), ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"int\": 1234567," ) && ContainsSubstring( "\"bool-1\": true," ) && ContainsSubstring( "\"bool-2\": false," ) && ContainsSubstring( "\"array\": [\n 2.5,\n 1234567\n ]\n}" ) for: "{ "double": 1.5, "int": 1234567, @@ -3014,7 +3020,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 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -test cases: 452 | 332 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2417 | 2216 passed | 158 failed | 43 failed as expected +test cases: 454 | 334 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2423 | 2222 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 712b1259..ffe7a2f6 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -1246,6 +1246,12 @@ Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\n\"" for: ""\n"" == Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\r\"" for: ""\r"" == ""\r"" Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\t\"" for: ""\t"" == ""\t"" Json.tests.cpp:<line number>: passed: sstream.str() == "\"\\\\/\\t\\r\\n\"" for: ""\\/\t\r\n"" == ""\\/\t\r\n"" +Json.tests.cpp:<line number>: passed: sstream.str() == "NaN" for: "NaN" == "NaN" +Json.tests.cpp:<line number>: passed: sstream.str() == "Infinity" for: "Infinity" == "Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "NaN" for: "NaN" == "NaN" +Json.tests.cpp:<line number>: passed: sstream.str() == "Infinity" for: "Infinity" == "Infinity" +Json.tests.cpp:<line number>: passed: sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" Json.tests.cpp:<line number>: passed: sstream.str(), ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"int\": 1234567," ) && ContainsSubstring( "\"bool-1\": true," ) && ContainsSubstring( "\"bool-2\": false," ) && ContainsSubstring( "\"array\": [\n 2.5,\n 1234567\n ]\n}" ) for: "{ "double": 1.5, "int": 1234567, @@ -3003,7 +3009,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 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -test cases: 452 | 332 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2417 | 2216 passed | 158 failed | 43 failed as expected +test cases: 454 | 334 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2423 | 2222 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index a833734a..344c5b03 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1743,6 +1743,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 452 | 350 passed | 76 failed | 7 skipped | 19 failed as expected -assertions: 2395 | 2216 passed | 136 failed | 43 failed as expected +test cases: 454 | 352 passed | 76 failed | 7 skipped | 19 failed as expected +assertions: 2401 | 2222 passed | 136 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 2de0a3a5..0729823f 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -8220,6 +8220,78 @@ with expansion: ""\\/\t\r\n"" == ""\\/\t\r\n"" ------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + NaN +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "NaN" ) +with expansion: + "NaN" == "NaN" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + Pos nf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "Infinity" ) +with expansion: + "Infinity" == "Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + Neg inf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "-Infinity" ) +with expansion: + "-Infinity" == "-Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + NaN +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "NaN" ) +with expansion: + "NaN" == "NaN" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + Pos nf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "Infinity" ) +with expansion: + "Infinity" == "Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + Neg inf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "-Infinity" ) +with expansion: + "-Infinity" == "-Infinity" + +------------------------------------------------------------------------------- JsonWriter serializes numbers independently of the global locale ------------------------------------------------------------------------------- Json.tests.cpp:<line number> @@ -20159,6 +20231,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 452 | 332 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2417 | 2216 passed | 158 failed | 43 failed as expected +test cases: 454 | 334 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2423 | 2222 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 9b6f023c..3db4bfc8 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -8218,6 +8218,78 @@ with expansion: ""\\/\t\r\n"" == ""\\/\t\r\n"" ------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + NaN +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "NaN" ) +with expansion: + "NaN" == "NaN" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + Pos nf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "Infinity" ) +with expansion: + "Infinity" == "Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - double + Neg inf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "-Infinity" ) +with expansion: + "-Infinity" == "-Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + NaN +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "NaN" ) +with expansion: + "NaN" == "NaN" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + Pos nf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "Infinity" ) +with expansion: + "Infinity" == "Infinity" + +------------------------------------------------------------------------------- +JsonWriter serializes non-finite FP using Python spelling - float + Neg inf +------------------------------------------------------------------------------- +Json.tests.cpp:<line number> +............................................................................... + +Json.tests.cpp:<line number>: PASSED: + REQUIRE( sstream.str() == "-Infinity" ) +with expansion: + "-Infinity" == "-Infinity" + +------------------------------------------------------------------------------- JsonWriter serializes numbers independently of the global locale ------------------------------------------------------------------------------- Json.tests.cpp:<line number> @@ -20148,6 +20220,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 452 | 332 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2417 | 2216 passed | 158 failed | 43 failed as expected +test cases: 454 | 334 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2423 | 2222 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index c84565d5..f58412b6 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="141" skipped="12" tests="2429" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2435" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -774,6 +774,14 @@ at Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/carriage return in a string is escaped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/tab in a string is escaped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/combination of characters is escaped" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/NaN" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/Pos nf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/Neg inf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/NaN" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/Pos nf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/Neg inf" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter serializes numbers independently of the global locale" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" 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 f4ff03d6..c80e5855 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="141" skipped="12" tests="2429" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2435" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -773,6 +773,14 @@ at Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/carriage return in a string is escaped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/tab in a string is escaped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter escapes characters in strings properly/combination of characters is escaped" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/NaN" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/Pos nf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - double/Neg inf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/NaN" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/Pos nf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="JsonWriter serializes non-finite FP using Python spelling - float/Neg inf" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="JsonWriter serializes numbers independently of the global locale" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index dceaca40..17c26f36 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -262,6 +262,14 @@ at AssertionHandler.tests.cpp:<line number> <testCase name="JsonWriter escapes characters in strings properly/carriage return in a string is escaped" duration="{duration}"/> <testCase name="JsonWriter escapes characters in strings properly/tab in a string is escaped" duration="{duration}"/> <testCase name="JsonWriter escapes characters in strings properly/combination of characters is escaped" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/NaN" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/Pos nf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/Neg inf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/NaN" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/Pos nf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/Neg inf" duration="{duration}"/> <testCase name="JsonWriter serializes numbers independently of the global locale" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp"> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 250b45ae..4c113189 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -261,6 +261,14 @@ at AssertionHandler.tests.cpp:<line number> <testCase name="JsonWriter escapes characters in strings properly/carriage return in a string is escaped" duration="{duration}"/> <testCase name="JsonWriter escapes characters in strings properly/tab in a string is escaped" duration="{duration}"/> <testCase name="JsonWriter escapes characters in strings properly/combination of characters is escaped" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/NaN" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/Pos nf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - double/Neg inf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/NaN" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/Pos nf" duration="{duration}"/> + <testCase name="JsonWriter serializes non-finite FP using Python spelling - float/Neg inf" duration="{duration}"/> <testCase name="JsonWriter serializes numbers independently of the global locale" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp"> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 7e9a19d6..4ac7f09f 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2054,6 +2054,18 @@ ok {test-number} - sstream.str() == "\"\\r\"" for: ""\r"" == ""\r"" ok {test-number} - sstream.str() == "\"\\t\"" for: ""\t"" == ""\t"" # JsonWriter escapes characters in strings properly ok {test-number} - sstream.str() == "\"\\\\/\\t\\r\\n\"" for: ""\\/\t\r\n"" == ""\\/\t\r\n"" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "NaN" for: "NaN" == "NaN" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "Infinity" for: "Infinity" == "Infinity" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "NaN" for: "NaN" == "NaN" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "Infinity" for: "Infinity" == "Infinity" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" # JsonWriter serializes numbers independently of the global locale ok {test-number} - sstream.str(), ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"int\": 1234567," ) && ContainsSubstring( "\"bool-1\": true," ) && ContainsSubstring( "\"bool-2\": false," ) && ContainsSubstring( "\"array\": [\n 2.5,\n 1234567\n ]\n}" ) for: "{ "double": 1.5, "int": 1234567, "bool-1": true, "bool-2": false, "array": [ 2.5, 1234567 ] }" ( contains: ""double": 1.5," and contains: ""int": 1234567," and contains: ""bool-1": true," and contains: ""bool-2": false," and contains: ""array": [ 2.5, 1234567 ] }" ) # Lambdas in assertions @@ -4853,5 +4865,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2429 +1..2435 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index edcb7813..3f1d56aa 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -2052,6 +2052,18 @@ ok {test-number} - sstream.str() == "\"\\r\"" for: ""\r"" == ""\r"" ok {test-number} - sstream.str() == "\"\\t\"" for: ""\t"" == ""\t"" # JsonWriter escapes characters in strings properly ok {test-number} - sstream.str() == "\"\\\\/\\t\\r\\n\"" for: ""\\/\t\r\n"" == ""\\/\t\r\n"" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "NaN" for: "NaN" == "NaN" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "Infinity" for: "Infinity" == "Infinity" +# JsonWriter serializes non-finite FP using Python spelling - double +ok {test-number} - sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "NaN" for: "NaN" == "NaN" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "Infinity" for: "Infinity" == "Infinity" +# JsonWriter serializes non-finite FP using Python spelling - float +ok {test-number} - sstream.str() == "-Infinity" for: "-Infinity" == "-Infinity" # JsonWriter serializes numbers independently of the global locale ok {test-number} - sstream.str(), ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"int\": 1234567," ) && ContainsSubstring( "\"bool-1\": true," ) && ContainsSubstring( "\"bool-2\": false," ) && ContainsSubstring( "\"array\": [\n 2.5,\n 1234567\n ]\n}" ) for: "{ "double": 1.5, "int": 1234567, "bool-1": true, "bool-2": false, "array": [ 2.5, 1234567 ] }" ( contains: ""double": 1.5," and contains: ""int": 1234567," and contains: ""bool-1": true," and contains: ""bool-2": false," and contains: ""array": [ 2.5, 1234567 ] }" ) # Lambdas in assertions @@ -4842,5 +4854,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2429 +1..2435 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index fc65c1c6..16fe73f9 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -470,6 +470,10 @@ ##teamcity[testFinished name='JsonWriter' duration="{duration}"] ##teamcity[testStarted name='JsonWriter escapes characters in strings properly'] ##teamcity[testFinished name='JsonWriter escapes characters in strings properly' duration="{duration}"] +##teamcity[testStarted name='JsonWriter serializes non-finite FP using Python spelling - double'] +##teamcity[testFinished name='JsonWriter serializes non-finite FP using Python spelling - double' duration="{duration}"] +##teamcity[testStarted name='JsonWriter serializes non-finite FP using Python spelling - float'] +##teamcity[testFinished name='JsonWriter serializes non-finite FP using Python spelling - float' duration="{duration}"] ##teamcity[testStarted name='JsonWriter serializes numbers independently of the global locale'] ##teamcity[testFinished name='JsonWriter serializes numbers independently of the global locale' duration="{duration}"] ##teamcity[testStarted name='Lambdas in assertions'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index f0a28ed7..acc777f2 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -470,6 +470,10 @@ ##teamcity[testFinished name='JsonWriter' duration="{duration}"] ##teamcity[testStarted name='JsonWriter escapes characters in strings properly'] ##teamcity[testFinished name='JsonWriter escapes characters in strings properly' duration="{duration}"] +##teamcity[testStarted name='JsonWriter serializes non-finite FP using Python spelling - double'] +##teamcity[testFinished name='JsonWriter serializes non-finite FP using Python spelling - double' duration="{duration}"] +##teamcity[testStarted name='JsonWriter serializes non-finite FP using Python spelling - float'] +##teamcity[testFinished name='JsonWriter serializes non-finite FP using Python spelling - float' duration="{duration}"] ##teamcity[testStarted name='JsonWriter serializes numbers independently of the global locale'] ##teamcity[testFinished name='JsonWriter serializes numbers independently of the global locale' duration="{duration}"] ##teamcity[testStarted name='Lambdas in assertions'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 31801eef..a7f8d3ae 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -9894,6 +9894,78 @@ Approx( 3.14150000000000018 ) </Section> <OverallResult success="true" skips="0"/> </TestCase> + <TestCase name="JsonWriter serializes non-finite FP using Python spelling - double" tags="[floating-point][JsonWriter]" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" > + <Section name="NaN" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" > + <Original> + sstream.str() == "NaN" + |