From 53ddf37af4488cac7724761858ae3cca9d2d65e7 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Mon, 15 Apr 2024 05:35:39 -0600 Subject: [PATCH] Use Catch::StringMaker for output in WithinRelMatcher (#2846) The WithinRelMatcher does not listen to the precision specification; it just naively pipes to stringstream. If you specify the precision, that has no impact on the outputted values when the match fails. This fix makes the WithinRelMatcher listen to the precision (https://github.com/catchorg/Catch2/blob/devel/docs/tostring.md#floating-point-precision) specified by: Catch::StringMaker::precision --- .../catch_matchers_floating_point.cpp | 2 +- .../Baselines/compact.sw.approved.txt | 20 +++++++++---------- .../Baselines/compact.sw.multi.approved.txt | 20 +++++++++---------- .../Baselines/console.sw.approved.txt | 20 +++++++++---------- .../Baselines/console.sw.multi.approved.txt | 20 +++++++++---------- tests/SelfTest/Baselines/tap.sw.approved.txt | 20 +++++++++---------- .../Baselines/tap.sw.multi.approved.txt | 20 +++++++++---------- tests/SelfTest/Baselines/xml.sw.approved.txt | 20 +++++++++---------- .../Baselines/xml.sw.multi.approved.txt | 20 +++++++++---------- 9 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp index 206332ef..fc7b444e 100644 --- a/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -176,7 +176,7 @@ namespace Detail { std::string WithinRelMatcher::describe() const { Catch::ReusableStringStream sstr; - sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; + sstr << "and " << ::Catch::Detail::stringify(m_target) << " are within " << m_epsilon * 100. << "% of each other"; return sstr.str(); } diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 037d7e9f..a0d83496 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -598,9 +598,9 @@ Misc.tests.cpp:: passed: Factorial(10) == 3628800 for: 3628800 (0x< GeneratorsImpl.tests.cpp:: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException Matchers.tests.cpp:: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other Matchers.tests.cpp:: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other -Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other +Matchers.tests.cpp:: passed: -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 Matchers.tests.cpp:: passed: 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0 Matchers.tests.cpp:: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 @@ -618,7 +618,7 @@ Matchers.tests.cpp:: passed: 1., WithinULP( 1., 0 ) for: 1.0 is wit Matchers.tests.cpp:: passed: -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) Matchers.tests.cpp:: passed: 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) Matchers.tests.cpp:: passed: WithinAbs( 1., 0. ) Matchers.tests.cpp:: passed: WithinAbs( 1., -1. ), std::domain_error Matchers.tests.cpp:: passed: WithinULP( 1., 0 ) @@ -626,11 +626,11 @@ Matchers.tests.cpp:: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:: passed: WithinRel( 1., 1. ), std::domain_error Matchers.tests.cpp:: passed: 1., !IsNaN() for: 1.0 not is NaN -Matchers.tests.cpp:: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other -Matchers.tests.cpp:: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other -Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other +Matchers.tests.cpp:: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other +Matchers.tests.cpp:: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other +Matchers.tests.cpp:: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 Matchers.tests.cpp:: passed: 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0 Matchers.tests.cpp:: passed: 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 @@ -650,7 +650,7 @@ Matchers.tests.cpp:: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is Matchers.tests.cpp:: passed: -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) Matchers.tests.cpp:: passed: 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) Matchers.tests.cpp:: passed: WithinAbs( 1.f, 0.f ) Matchers.tests.cpp:: passed: WithinAbs( 1.f, -1.f ), std::domain_error Matchers.tests.cpp:: passed: WithinULP( 1.f, 0 ) diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index b26546c1..40083820 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -596,9 +596,9 @@ Misc.tests.cpp:: passed: Factorial(10) == 3628800 for: 3628800 (0x< GeneratorsImpl.tests.cpp:: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException Matchers.tests.cpp:: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other Matchers.tests.cpp:: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other -Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other +Matchers.tests.cpp:: passed: -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 Matchers.tests.cpp:: passed: 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0 Matchers.tests.cpp:: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0 @@ -616,7 +616,7 @@ Matchers.tests.cpp:: passed: 1., WithinULP( 1., 0 ) for: 1.0 is wit Matchers.tests.cpp:: passed: -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) Matchers.tests.cpp:: passed: 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) Matchers.tests.cpp:: passed: 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) Matchers.tests.cpp:: passed: WithinAbs( 1., 0. ) Matchers.tests.cpp:: passed: WithinAbs( 1., -1. ), std::domain_error Matchers.tests.cpp:: passed: WithinULP( 1., 0 ) @@ -624,11 +624,11 @@ Matchers.tests.cpp:: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:: passed: WithinRel( 1., 1. ), std::domain_error Matchers.tests.cpp:: passed: 1., !IsNaN() for: 1.0 not is NaN -Matchers.tests.cpp:: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other -Matchers.tests.cpp:: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other -Matchers.tests.cpp:: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other -Matchers.tests.cpp:: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other -Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other +Matchers.tests.cpp:: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other +Matchers.tests.cpp:: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other +Matchers.tests.cpp:: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other +Matchers.tests.cpp:: passed: v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 Matchers.tests.cpp:: passed: 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0 Matchers.tests.cpp:: passed: 0.f, !WithinAbs( 1.f, 0.99f ) for: 0.0f not is within 0.9900000095 of 1.0 @@ -648,7 +648,7 @@ Matchers.tests.cpp:: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is Matchers.tests.cpp:: passed: -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) Matchers.tests.cpp:: passed: 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) Matchers.tests.cpp:: passed: 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) -Matchers.tests.cpp:: passed: 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +Matchers.tests.cpp:: passed: 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) Matchers.tests.cpp:: passed: WithinAbs( 1.f, 0.f ) Matchers.tests.cpp:: passed: WithinAbs( 1.f, -1.f ), std::domain_error Matchers.tests.cpp:: passed: WithinULP( 1.f, 0 ) diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index a14ead16..2424ea11 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -4487,12 +4487,12 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) ) with expansion: - 1.0 not and 0 are within 99% of each other + 1.0 not and 0.0 are within 99% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( -0., WithinRel( 0. ) ) with expansion: - -0.0 and 0 are within 2.22045e-12% of each other + -0.0 and 0.0 are within 2.22045e-12% of each other ------------------------------------------------------------------------------- Floating point matchers: double @@ -4505,7 +4505,7 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: - 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + 0.0 and 0.0 are within 2.22045e-12% of each other ------------------------------------------------------------------------------- Floating point matchers: double @@ -4625,7 +4625,7 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) ) with expansion: - 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) ------------------------------------------------------------------------------- Floating point matchers: double @@ -4674,22 +4674,22 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) ) with expansion: - 10.0f and 11.1 are within 10% of each other + 10.0f and 11.1000003815 are within 10% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) ) with expansion: - 10.0f not and 11.2 are within 10% of each other + 10.0f not and 11.1999998093 are within 10% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) ) with expansion: - 1.0f not and 0 are within 99% of each other + 1.0f not and 0.0 are within 99% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( -0.f, WithinRel( 0.f ) ) with expansion: - -0.0f and 0 are within 0.00119209% of each other + -0.0f and 0.0 are within 0.00119209% of each other ------------------------------------------------------------------------------- Floating point matchers: float @@ -4702,7 +4702,7 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: - 0.0f and 1.17549e-38 are within 0.00119209% of each other + 0.0f and 0.0 are within 0.00119209% of each other ------------------------------------------------------------------------------- Floating point matchers: float @@ -4827,7 +4827,7 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) ) with expansion: - 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) ------------------------------------------------------------------------------- Floating point matchers: float diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index b706c566..e8fd62f7 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -4485,12 +4485,12 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) ) with expansion: - 1.0 not and 0 are within 99% of each other + 1.0 not and 0.0 are within 99% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( -0., WithinRel( 0. ) ) with expansion: - -0.0 and 0 are within 2.22045e-12% of each other + -0.0 and 0.0 are within 2.22045e-12% of each other ------------------------------------------------------------------------------- Floating point matchers: double @@ -4503,7 +4503,7 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: - 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + 0.0 and 0.0 are within 2.22045e-12% of each other ------------------------------------------------------------------------------- Floating point matchers: double @@ -4623,7 +4623,7 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) ) with expansion: - 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) ------------------------------------------------------------------------------- Floating point matchers: double @@ -4672,22 +4672,22 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) ) with expansion: - 10.0f and 11.1 are within 10% of each other + 10.0f and 11.1000003815 are within 10% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) ) with expansion: - 10.0f not and 11.2 are within 10% of each other + 10.0f not and 11.1999998093 are within 10% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) ) with expansion: - 1.0f not and 0 are within 99% of each other + 1.0f not and 0.0 are within 99% of each other Matchers.tests.cpp:: PASSED: REQUIRE_THAT( -0.f, WithinRel( 0.f ) ) with expansion: - -0.0f and 0 are within 0.00119209% of each other + -0.0f and 0.0 are within 0.00119209% of each other ------------------------------------------------------------------------------- Floating point matchers: float @@ -4700,7 +4700,7 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( v1, WithinRel( v2 ) ) with expansion: - 0.0f and 1.17549e-38 are within 0.00119209% of each other + 0.0f and 0.0 are within 0.00119209% of each other ------------------------------------------------------------------------------- Floating point matchers: float @@ -4825,7 +4825,7 @@ with expansion: Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) ) with expansion: - 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) ------------------------------------------------------------------------------- Floating point matchers: float diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 7ece3f86..d9d34590 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1129,11 +1129,11 @@ ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% # Floating point matchers: double ok {test-number} - 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other # Floating point matchers: double -ok {test-number} - 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other +ok {test-number} - 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other # Floating point matchers: double -ok {test-number} - -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other +ok {test-number} - -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other # Floating point matchers: double -ok {test-number} - v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other # Floating point matchers: double ok {test-number} - 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 # Floating point matchers: double @@ -1169,7 +1169,7 @@ ok {test-number} - 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is # Floating point matchers: double ok {test-number} - 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) # Floating point matchers: double -ok {test-number} - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) # Floating point matchers: double ok {test-number} - WithinAbs( 1., 0. ) # Floating point matchers: double @@ -1185,15 +1185,15 @@ 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 +ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other # Floating point matchers: float -ok {test-number} - 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other +ok {test-number} - 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other # Floating point matchers: float -ok {test-number} - 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other +ok {test-number} - 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other # Floating point matchers: float -ok {test-number} - -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other +ok {test-number} - -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other # Floating point matchers: float -ok {test-number} - v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other # Floating point matchers: float ok {test-number} - 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 # Floating point matchers: float @@ -1233,7 +1233,7 @@ ok {test-number} - 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( # Floating point matchers: float ok {test-number} - 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) # Floating point matchers: float -ok {test-number} - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) # Floating point matchers: float ok {test-number} - WithinAbs( 1.f, 0.f ) # Floating point matchers: float diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 2dfcb652..a439fdef 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -1127,11 +1127,11 @@ ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% # Floating point matchers: double ok {test-number} - 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other # Floating point matchers: double -ok {test-number} - 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other +ok {test-number} - 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other # Floating point matchers: double -ok {test-number} - -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other +ok {test-number} - -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other # Floating point matchers: double -ok {test-number} - v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other # Floating point matchers: double ok {test-number} - 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0 # Floating point matchers: double @@ -1167,7 +1167,7 @@ ok {test-number} - 1., WithinAbs( 1., 0.5 ) || WithinULP( 2., 1 ) for: 1.0 ( is # Floating point matchers: double ok {test-number} - 1., WithinAbs( 2., 0.5 ) || WithinULP( 1., 0 ) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) # Floating point matchers: double -ok {test-number} - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) for: 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) # Floating point matchers: double ok {test-number} - WithinAbs( 1., 0. ) # Floating point matchers: double @@ -1183,15 +1183,15 @@ 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 +ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other # Floating point matchers: float -ok {test-number} - 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other +ok {test-number} - 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other # Floating point matchers: float -ok {test-number} - 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other +ok {test-number} - 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other # Floating point matchers: float -ok {test-number} - -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other +ok {test-number} - -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other # Floating point matchers: float -ok {test-number} - v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +ok {test-number} - v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other # Floating point matchers: float ok {test-number} - 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0 # Floating point matchers: float @@ -1231,7 +1231,7 @@ ok {test-number} - 1.f, WithinAbs( 1.f, 0.5 ) || WithinULP( 1.f, 1 ) for: 1.0f ( # Floating point matchers: float ok {test-number} - 1.f, WithinAbs( 2.f, 0.5 ) || WithinULP( 1.f, 0 ) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) # Floating point matchers: float -ok {test-number} - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +ok {test-number} - 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) for: 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) # Floating point matchers: float ok {test-number} - WithinAbs( 1.f, 0.f ) # Floating point matchers: float diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 01af9edd..e3a6dc0f 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -5022,7 +5022,7 @@ C 1., !WithinRel( 0., 0.99 ) - 1.0 not and 0 are within 99% of each other + 1.0 not and 0.0 are within 99% of each other @@ -5030,7 +5030,7 @@ C -0., WithinRel( 0. ) - -0.0 and 0 are within 2.22045e-12% of each other + -0.0 and 0.0 are within 2.22045e-12% of each other
@@ -5039,7 +5039,7 @@ C v1, WithinRel( v2 ) - 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + 0.0 and 0.0 are within 2.22045e-12% of each other @@ -5194,7 +5194,7 @@ C 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) - 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) @@ -5270,7 +5270,7 @@ C 10.f, WithinRel( 11.1f, 0.1f ) - 10.0f and 11.1 are within 10% of each other + 10.0f and 11.1000003815 are within 10% of each other @@ -5278,7 +5278,7 @@ C 10.f, !WithinRel( 11.2f, 0.1f ) - 10.0f not and 11.2 are within 10% of each other + 10.0f not and 11.1999998093 are within 10% of each other @@ -5286,7 +5286,7 @@ C 1.f, !WithinRel( 0.f, 0.99f ) - 1.0f not and 0 are within 99% of each other + 1.0f not and 0.0 are within 99% of each other @@ -5294,7 +5294,7 @@ C -0.f, WithinRel( 0.f ) - -0.0f and 0 are within 0.00119209% of each other + -0.0f and 0.0 are within 0.00119209% of each other
@@ -5303,7 +5303,7 @@ C v1, WithinRel( v2 ) - 0.0f and 1.17549e-38 are within 0.00119209% of each other + 0.0f and 0.0 are within 0.00119209% of each other @@ -5474,7 +5474,7 @@ C 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) - 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 6c50a996..62a2740a 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -5022,7 +5022,7 @@ C 1., !WithinRel( 0., 0.99 ) - 1.0 not and 0 are within 99% of each other + 1.0 not and 0.0 are within 99% of each other @@ -5030,7 +5030,7 @@ C -0., WithinRel( 0. ) - -0.0 and 0 are within 2.22045e-12% of each other + -0.0 and 0.0 are within 2.22045e-12% of each other
@@ -5039,7 +5039,7 @@ C v1, WithinRel( v2 ) - 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + 0.0 and 0.0 are within 2.22045e-12% of each other @@ -5194,7 +5194,7 @@ C 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) - 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other ) @@ -5270,7 +5270,7 @@ C 10.f, WithinRel( 11.1f, 0.1f ) - 10.0f and 11.1 are within 10% of each other + 10.0f and 11.1000003815 are within 10% of each other @@ -5278,7 +5278,7 @@ C 10.f, !WithinRel( 11.2f, 0.1f ) - 10.0f not and 11.2 are within 10% of each other + 10.0f not and 11.1999998093 are within 10% of each other @@ -5286,7 +5286,7 @@ C 1.f, !WithinRel( 0.f, 0.99f ) - 1.0f not and 0 are within 99% of each other + 1.0f not and 0.0 are within 99% of each other @@ -5294,7 +5294,7 @@ C -0.f, WithinRel( 0.f ) - -0.0f and 0 are within 0.00119209% of each other + -0.0f and 0.0 are within 0.00119209% of each other
@@ -5303,7 +5303,7 @@ C v1, WithinRel( v2 ) - 0.0f and 1.17549e-38 are within 0.00119209% of each other + 0.0f and 0.0 are within 0.00119209% of each other @@ -5474,7 +5474,7 @@ C 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) - 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + 0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other )