Default StringMaker<FloatingPointType>::precision to max_digits10

`max_digits10` is the number of decimal digits that the type _can_
represent, in other words, the number of decimal digits needed to
disambiguate any two floating point numbers when serialized to
a string.
This commit is contained in:
Martin Hořeňovský
2024-04-30 16:43:05 +02:00
parent efb39689d9
commit ef713582d2
18 changed files with 2109 additions and 1071 deletions

View File

@@ -517,35 +517,39 @@ at Condition.tests.cpp:<line number>
FAILED:
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
with expansion:
9.1f == Approx( 9.1099996567 )
9.100000381f
==
Approx( 9.10999965667724609 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.float_nine_point_one == Approx( 9.0f )" type="CHECK">
FAILED:
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
with expansion:
9.1f == Approx( 9.0 )
9.100000381f == Approx( 9.0 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.float_nine_point_one == Approx( 1 )" type="CHECK">
FAILED:
CHECK( data.float_nine_point_one == Approx( 1 ) )
with expansion:
9.1f == Approx( 1.0 )
9.100000381f == Approx( 1.0 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.float_nine_point_one == Approx( 0 )" type="CHECK">
FAILED:
CHECK( data.float_nine_point_one == Approx( 0 ) )
with expansion:
9.1f == Approx( 0.0 )
9.100000381f == Approx( 0.0 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.double_pi == Approx( 3.1415 )" type="CHECK">
FAILED:
CHECK( data.double_pi == Approx( 3.1415 ) )
with expansion:
3.1415926535 == Approx( 3.1415 )
3.14159265350000005
==
Approx( 3.14150000000000018 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.str_hello == &quot;goodbye&quot;" type="CHECK">
@@ -580,7 +584,9 @@ at Condition.tests.cpp:<line number>
FAILED:
CHECK( x == Approx( 1.301 ) )
with expansion:
1.3 == Approx( 1.301 )
1.30000000000000027
==
Approx( 1.30099999999999993 )
at Condition.tests.cpp:<line number>
</failure>
</testcase>
@@ -828,14 +834,18 @@ at Condition.tests.cpp:<line number>
FAILED:
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
with expansion:
9.1f != Approx( 9.1000003815 )
9.100000381f
!=
Approx( 9.10000038146972656 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.double_pi != Approx( 3.1415926535 )" type="CHECK">
FAILED:
CHECK( data.double_pi != Approx( 3.1415926535 ) )
with expansion:
3.1415926535 != Approx( 3.1415926535 )
3.14159265350000005
!=
Approx( 3.14159265350000005 )
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.str_hello != &quot;hello&quot;" type="CHECK">
@@ -1011,21 +1021,21 @@ at Condition.tests.cpp:<line number>
FAILED:
CHECK( data.float_nine_point_one &lt; 9 )
with expansion:
9.1f &lt; 9
9.100000381f &lt; 9
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.float_nine_point_one > 10" type="CHECK">
FAILED:
CHECK( data.float_nine_point_one > 10 )
with expansion:
9.1f > 10
9.100000381f > 10
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.float_nine_point_one > 9.2" type="CHECK">
FAILED:
CHECK( data.float_nine_point_one > 9.2 )
with expansion:
9.1f > 9.2
9.100000381f > 9.19999999999999929
at Condition.tests.cpp:<line number>
</failure>
<failure message="data.str_hello > &quot;hello&quot;" type="CHECK">
@@ -1453,7 +1463,7 @@ at Exception.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Unexpected exceptions can be translated" time="{duration}" status="run">
<error type="TEST_CASE">
FAILED:
3.14
3.14000000000000012
at Exception.tests.cpp:<line number>
</error>
</testcase>