lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2f9e574 4/8: Add a failing unit test


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2f9e574 4/8: Add a failing unit test
Date: Sat, 17 Mar 2018 19:12:57 -0400 (EDT)

branch: master
commit 2f9e57413c83bf1cd8616b2f005b254b5f8f44f8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Add a failing unit test
    
    If rounded for printing, 999999.9 becomes 1000000, so it needs scaling
    if 1000000 does.
---
 miscellany_test.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/miscellany_test.cpp b/miscellany_test.cpp
index 0803313..bd2148c 100644
--- a/miscellany_test.cpp
+++ b/miscellany_test.cpp
@@ -312,6 +312,11 @@ void test_scale_power()
     BOOST_TEST_EQUAL( 0, scale_power( 9,     -99'999'999.0,               
0.0));
     BOOST_TEST_EQUAL( 0, scale_power( 9,     999'999'999.0,     
999'999'999.0));
 
+    // 999,999,999.0 rounds to 999,999,999
+    BOOST_TEST_EQUAL( 0, scale_power( 9,     -99'999'999.0,     
999'999'999.0));
+    // 999,999.999.9 may round to 1,000,000,000
+    BOOST_TEST_EQUAL( 3, scale_power( 9,     -99'999'999.9,     
999'999'999.9));
+
     BOOST_TEST_EQUAL( 3, scale_power( 9,    -999'999'999.0,   
1'999'999'999.0));
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]