Skip to content

Commit 53ddf37

Browse files
authored
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<float>::precision
1 parent 029fe3b commit 53ddf37

9 files changed

+81
-81
lines changed

src/catch2/matchers/catch_matchers_floating_point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ namespace Detail {
176176

177177
std::string WithinRelMatcher::describe() const {
178178
Catch::ReusableStringStream sstr;
179-
sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other";
179+
sstr << "and " << ::Catch::Detail::stringify(m_target) << " are within " << m_epsilon * 100. << "% of each other";
180180
return sstr.str();
181181
}
182182

tests/SelfTest/Baselines/compact.sw.approved.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<
598598
GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
599599
Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
600600
Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other
601-
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other
602-
Matchers.tests.cpp:<line number>: passed: -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other
603-
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other
601+
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other
602+
Matchers.tests.cpp:<line number>: passed: -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other
603+
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other
604604
Matchers.tests.cpp:<line number>: passed: 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0
605605
Matchers.tests.cpp:<line number>: passed: 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0
606606
Matchers.tests.cpp:<line number>: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0
@@ -618,19 +618,19 @@ Matchers.tests.cpp:<line number>: passed: 1., WithinULP( 1., 0 ) for: 1.0 is wit
618618
Matchers.tests.cpp:<line number>: passed: -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00])
619619
Matchers.tests.cpp:<line number>: 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]) )
620620
Matchers.tests.cpp:<line number>: 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]) )
621-
Matchers.tests.cpp:<line number>: 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 )
621+
Matchers.tests.cpp:<line number>: 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 )
622622
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1., 0. )
623623
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1., -1. ), std::domain_error
624624
Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 )
625625
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. )
626626
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error
627627
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error
628628
Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN
629-
Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other
630-
Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other
631-
Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other
632-
Matchers.tests.cpp:<line number>: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other
633-
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other
629+
Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other
630+
Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other
631+
Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other
632+
Matchers.tests.cpp:<line number>: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other
633+
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other
634634
Matchers.tests.cpp:<line number>: passed: 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0
635635
Matchers.tests.cpp:<line number>: passed: 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0
636636
Matchers.tests.cpp:<line number>: 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:<line number>: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is
650650
Matchers.tests.cpp:<line number>: passed: -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00])
651651
Matchers.tests.cpp:<line number>: 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]) )
652652
Matchers.tests.cpp:<line number>: 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]) )
653-
Matchers.tests.cpp:<line number>: 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 )
653+
Matchers.tests.cpp:<line number>: 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 )
654654
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1.f, 0.f )
655655
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1.f, -1.f ), std::domain_error
656656
Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, 0 )

tests/SelfTest/Baselines/compact.sw.multi.approved.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<
596596
GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
597597
Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
598598
Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other
599-
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other
600-
Matchers.tests.cpp:<line number>: passed: -0., WithinRel( 0. ) for: -0.0 and 0 are within 2.22045e-12% of each other
601-
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other
599+
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0.0 are within 99% of each other
600+
Matchers.tests.cpp:<line number>: passed: -0., WithinRel( 0. ) for: -0.0 and 0.0 are within 2.22045e-12% of each other
601+
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0 and 0.0 are within 2.22045e-12% of each other
602602
Matchers.tests.cpp:<line number>: passed: 1., WithinAbs( 1., 0 ) for: 1.0 is within 0.0 of 1.0
603603
Matchers.tests.cpp:<line number>: passed: 0., WithinAbs( 1., 1 ) for: 0.0 is within 1.0 of 1.0
604604
Matchers.tests.cpp:<line number>: passed: 0., !WithinAbs( 1., 0.99 ) for: 0.0 not is within 0.99 of 1.0
@@ -616,19 +616,19 @@ Matchers.tests.cpp:<line number>: passed: 1., WithinULP( 1., 0 ) for: 1.0 is wit
616616
Matchers.tests.cpp:<line number>: passed: -0., WithinULP( 0., 0 ) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00])
617617
Matchers.tests.cpp:<line number>: 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]) )
618618
Matchers.tests.cpp:<line number>: 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]) )
619-
Matchers.tests.cpp:<line number>: 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 )
619+
Matchers.tests.cpp:<line number>: 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 )
620620
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1., 0. )
621621
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1., -1. ), std::domain_error
622622
Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 )
623623
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. )
624624
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error
625625
Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error
626626
Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN
627-
Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other
628-
Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other
629-
Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other
630-
Matchers.tests.cpp:<line number>: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0 are within 0.00119209% of each other
631-
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other
627+
Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1000003815 are within 10% of each other
628+
Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.1999998093 are within 10% of each other
629+
Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0.0 are within 99% of each other
630+
Matchers.tests.cpp:<line number>: passed: -0.f, WithinRel( 0.f ) for: -0.0f and 0.0 are within 0.00119209% of each other
631+
Matchers.tests.cpp:<line number>: passed: v1, WithinRel( v2 ) for: 0.0f and 0.0 are within 0.00119209% of each other
632632
Matchers.tests.cpp:<line number>: passed: 1.f, WithinAbs( 1.f, 0 ) for: 1.0f is within 0.0 of 1.0
633633
Matchers.tests.cpp:<line number>: passed: 0.f, WithinAbs( 1.f, 1 ) for: 0.0f is within 1.0 of 1.0
634634
Matchers.tests.cpp:<line number>: 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:<line number>: passed: 1.f, WithinULP( 1.f, 0 ) for: 1.0f is
648648
Matchers.tests.cpp:<line number>: passed: -0.f, WithinULP( 0.f, 0 ) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00])
649649
Matchers.tests.cpp:<line number>: 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]) )
650650
Matchers.tests.cpp:<line number>: 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]) )
651-
Matchers.tests.cpp:<line number>: 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 )
651+
Matchers.tests.cpp:<line number>: 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 )
652652
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1.f, 0.f )
653653
Matchers.tests.cpp:<line number>: passed: WithinAbs( 1.f, -1.f ), std::domain_error
654654
Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, 0 )

tests/SelfTest/Baselines/console.sw.approved.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4487,12 +4487,12 @@ with expansion:
44874487
Matchers.tests.cpp:<line number>: PASSED:
44884488
REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) )
44894489
with expansion:
4490-
1.0 not and 0 are within 99% of each other
4490+
1.0 not and 0.0 are within 99% of each other
44914491

44924492
Matchers.tests.cpp:<line number>: PASSED:
44934493
REQUIRE_THAT( -0., WithinRel( 0. ) )
44944494
with expansion:
4495-
-0.0 and 0 are within 2.22045e-12% of each other
4495+
-0.0 and 0.0 are within 2.22045e-12% of each other
44964496

44974497
-------------------------------------------------------------------------------
44984498
Floating point matchers: double
@@ -4505,7 +4505,7 @@ Matchers.tests.cpp:<line number>
45054505
Matchers.tests.cpp:<line number>: PASSED:
45064506
REQUIRE_THAT( v1, WithinRel( v2 ) )
45074507
with expansion:
4508-
0.0 and 2.22507e-308 are within 2.22045e-12% of each other
4508+
0.0 and 0.0 are within 2.22045e-12% of each other
45094509

45104510
-------------------------------------------------------------------------------
45114511
Floating point matchers: double
@@ -4625,7 +4625,7 @@ with expansion:
46254625
Matchers.tests.cpp:<line number>: PASSED:
46264626
REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) )
46274627
with expansion:
4628-
0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other )
4628+
0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other )
46294629

46304630
-------------------------------------------------------------------------------
46314631
Floating point matchers: double
@@ -4674,22 +4674,22 @@ Matchers.tests.cpp:<line number>
46744674
Matchers.tests.cpp:<line number>: PASSED:
46754675
REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) )
46764676
with expansion:
4677-
10.0f and 11.1 are within 10% of each other
4677+
10.0f and 11.1000003815 are within 10% of each other
46784678

46794679
Matchers.tests.cpp:<line number>: PASSED:
46804680
REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) )
46814681
with expansion:
4682-
10.0f not and 11.2 are within 10% of each other
4682+
10.0f not and 11.1999998093 are within 10% of each other
46834683

46844684
Matchers.tests.cpp:<line number>: PASSED:
46854685
REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) )
46864686
with expansion:
4687-
1.0f not and 0 are within 99% of each other
4687+
1.0f not and 0.0 are within 99% of each other
46884688

46894689
Matchers.tests.cpp:<line number>: PASSED:
46904690
REQUIRE_THAT( -0.f, WithinRel( 0.f ) )
46914691
with expansion:
4692-
-0.0f and 0 are within 0.00119209% of each other
4692+
-0.0f and 0.0 are within 0.00119209% of each other
46934693

46944694
-------------------------------------------------------------------------------
46954695
Floating point matchers: float
@@ -4702,7 +4702,7 @@ Matchers.tests.cpp:<line number>
47024702
Matchers.tests.cpp:<line number>: PASSED:
47034703
REQUIRE_THAT( v1, WithinRel( v2 ) )
47044704
with expansion:
4705-
0.0f and 1.17549e-38 are within 0.00119209% of each other
4705+
0.0f and 0.0 are within 0.00119209% of each other
47064706

47074707
-------------------------------------------------------------------------------
47084708
Floating point matchers: float
@@ -4827,7 +4827,7 @@ with expansion:
48274827
Matchers.tests.cpp:<line number>: PASSED:
48284828
REQUIRE_THAT( 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) )
48294829
with expansion:
4830-
0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other )
4830+
0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other )
48314831

48324832
-------------------------------------------------------------------------------
48334833
Floating point matchers: float

tests/SelfTest/Baselines/console.sw.multi.approved.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4485,12 +4485,12 @@ with expansion:
44854485
Matchers.tests.cpp:<line number>: PASSED:
44864486
REQUIRE_THAT( 1., !WithinRel( 0., 0.99 ) )
44874487
with expansion:
4488-
1.0 not and 0 are within 99% of each other
4488+
1.0 not and 0.0 are within 99% of each other
44894489

44904490
Matchers.tests.cpp:<line number>: PASSED:
44914491
REQUIRE_THAT( -0., WithinRel( 0. ) )
44924492
with expansion:
4493-
-0.0 and 0 are within 2.22045e-12% of each other
4493+
-0.0 and 0.0 are within 2.22045e-12% of each other
44944494

44954495
-------------------------------------------------------------------------------
44964496
Floating point matchers: double
@@ -4503,7 +4503,7 @@ Matchers.tests.cpp:<line number>
45034503
Matchers.tests.cpp:<line number>: PASSED:
45044504
REQUIRE_THAT( v1, WithinRel( v2 ) )
45054505
with expansion:
4506-
0.0 and 2.22507e-308 are within 2.22045e-12% of each other
4506+
0.0 and 0.0 are within 2.22045e-12% of each other
45074507

45084508
-------------------------------------------------------------------------------
45094509
Floating point matchers: double
@@ -4623,7 +4623,7 @@ with expansion:
46234623
Matchers.tests.cpp:<line number>: PASSED:
46244624
REQUIRE_THAT( 0.0001, WithinAbs( 0., 0.001 ) || WithinRel( 0., 0.1 ) )
46254625
with expansion:
4626-
0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other )
4626+
0.0001 ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other )
46274627

46284628
-------------------------------------------------------------------------------
46294629
Floating point matchers: double
@@ -4672,22 +4672,22 @@ Matchers.tests.cpp:<line number>
46724672
Matchers.tests.cpp:<line number>: PASSED:
46734673
REQUIRE_THAT( 10.f, WithinRel( 11.1f, 0.1f ) )
46744674
with expansion:
4675-
10.0f and 11.1 are within 10% of each other
4675+
10.0f and 11.1000003815 are within 10% of each other
46764676

46774677
Matchers.tests.cpp:<line number>: PASSED:
46784678
REQUIRE_THAT( 10.f, !WithinRel( 11.2f, 0.1f ) )
46794679
with expansion:
4680-
10.0f not and 11.2 are within 10% of each other
4680+
10.0f not and 11.1999998093 are within 10% of each other
46814681

46824682
Matchers.tests.cpp:<line number>: PASSED:
46834683
REQUIRE_THAT( 1.f, !WithinRel( 0.f, 0.99f ) )
46844684
with expansion:
4685-
1.0f not and 0 are within 99% of each other
4685+
1.0f not and 0.0 are within 99% of each other
46864686

46874687
Matchers.tests.cpp:<line number>: PASSED:
46884688
REQUIRE_THAT( -0.f, WithinRel( 0.f ) )
46894689
with expansion:
4690-
-0.0f and 0 are within 0.00119209% of each other
4690+
-0.0f and 0.0 are within 0.00119209% of each other
46914691

46924692
-------------------------------------------------------------------------------
46934693
Floating point matchers: float
@@ -4700,7 +4700,7 @@ Matchers.tests.cpp:<line number>
47004700
Matchers.tests.cpp:<line number>: PASSED:
47014701
REQUIRE_THAT( v1, WithinRel( v2 ) )
47024702
with expansion:
4703-
0.0f and 1.17549e-38 are within 0.00119209% of each other
4703+
0.0f and 0.0 are within 0.00119209% of each other
47044704

47054705
-------------------------------------------------------------------------------
47064706
Floating point matchers: float
@@ -4825,7 +4825,7 @@ with expansion:
48254825
Matchers.tests.cpp:<line number>: PASSED:
48264826
REQUIRE_THAT( 0.0001f, WithinAbs( 0.f, 0.001f ) || WithinRel( 0.f, 0.1f ) )
48274827
with expansion:
4828-
0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other )
4828+
0.0001f ( is within 0.001 of 0.0 or and 0.0 are within 10% of each other )
48294829

48304830
-------------------------------------------------------------------------------
48314831
Floating point matchers: float

0 commit comments

Comments
 (0)