Changed Approx::toString() to be implemented in terms of toString( double ) (as proposed in #233)

This commit is contained in:
Phil Nash
2013-12-19 18:41:55 +00:00
parent fb90d38310
commit 1aa60fada9
6 changed files with 67 additions and 59 deletions

View File

@@ -73,13 +73,13 @@ ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 1.23f == Approx( 1.23f ) )
with expansion:
1.23 == Approx( 1.23 )
1.23 == Approx( 1.2300000191 )
ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 0.0f == Approx( 0.0f ) )
with expansion:
0 == Approx( 0 )
0 == Approx( 0.0 )
-------------------------------------------------------------------------------
Approximate comparisons with ints
@@ -90,10 +90,14 @@ ApproxTests.cpp:<line number>
ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 1 == Approx( 1 ) )
with expansion:
1 == Approx( 1.0 )
ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 0 == Approx( 0 ) )
with expansion:
0 == Approx( 0.0 )
-------------------------------------------------------------------------------
Approximate comparisons with mixed numeric types
@@ -105,19 +109,19 @@ ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 1.0f == Approx( 1 ) )
with expansion:
1 == Approx( 1 )
1 == Approx( 1.0 )
ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 0 == Approx( dZero) )
with expansion:
0 == Approx( 0 )
0 == Approx( 0.0 )
ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
with expansion:
0 == Approx( 1e-05 )
0 == Approx( 0.00001 )
ApproxTests.cpp:<line number>:
PASSED:
@@ -129,7 +133,7 @@ ApproxTests.cpp:<line number>:
PASSED:
REQUIRE( dMedium == Approx( 1.234f ) )
with expansion:
1.234 == Approx( 1.234 )
1.234 == Approx( 1.2339999676 )
-------------------------------------------------------------------------------
Use a custom approx
@@ -265,13 +269,13 @@ ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
with expansion:
9.1 == Approx( 9.1 )
9.1 == Approx( 9.1000003815 )
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
with expansion:
3.1415926535 == Approx( 3.14159 )
3.1415926535 == Approx( 3.1415926535 )
ConditionTests.cpp:<line number>:
PASSED:
@@ -321,22 +325,22 @@ with expansion:
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
with expansion:
9.1 == Approx( 9.11 )
9.1 == Approx( 9.1099996567 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
with expansion:
9.1 == Approx( 9 )
9.1 == Approx( 9.0 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.float_nine_point_one == Approx( 1 ) )
with expansion:
9.1 == Approx( 1 )
9.1 == Approx( 1.0 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.float_nine_point_one == Approx( 0 ) )
with expansion:
9.1 == Approx( 0 )
9.1 == Approx( 0.0 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.double_pi == Approx( 3.1415 ) )
@@ -390,25 +394,25 @@ ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) )
with expansion:
9.1 != Approx( 9.11 )
9.1 != Approx( 9.1099996567 )
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) )
with expansion:
9.1 != Approx( 9 )
9.1 != Approx( 9.0 )
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one != Approx( 1 ) )
with expansion:
9.1 != Approx( 1 )
9.1 != Approx( 1.0 )
ConditionTests.cpp:<line number>:
PASSED:
REQUIRE( data.float_nine_point_one != Approx( 0 ) )
with expansion:
9.1 != Approx( 0 )
9.1 != Approx( 0.0 )
ConditionTests.cpp:<line number>:
PASSED:
@@ -454,12 +458,12 @@ with expansion:
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
with expansion:
9.1 != Approx( 9.1 )
9.1 != Approx( 9.1000003815 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.double_pi != Approx( 3.1415926535 ) )
with expansion:
3.1415926535 != Approx( 3.14159 )
3.1415926535 != Approx( 3.1415926535 )
ConditionTests.cpp:<line number>: FAILED:
CHECK( data.str_hello != "hello" )