[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 50b6290 2/8: Add a failing unit test
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 50b6290 2/8: Add a failing unit test |
Date: |
Sat, 17 Mar 2018 19:12:56 -0400 (EDT) |
branch: master
commit 50b6290f022a17bd7939d3aa4d724638ea1856a2
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add a failing unit test
This tricky statement:
double widest = std::max
(min_value * -10
,max_value
);
doesn't do the right thing for
1'999'999'999.0 min_value
-999'999'999.0 max_value
because it violates the assumption that min_value <= max_value. That
precondition must hold, because std::minmax_element() produces those
values; but it should be asserted, because their connection to that
standard-library function is indirect.
Of course, no assertion can make the statement less tricky.
---
miscellany_test.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/miscellany_test.cpp b/miscellany_test.cpp
index b8ecebd..91f10b1 100644
--- a/miscellany_test.cpp
+++ b/miscellany_test.cpp
@@ -299,6 +299,9 @@ void test_scale_power()
BOOST_TEST_EQUAL( 0, scale_power( 9, 0.0,
999'999'999.0));
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));
+
+ BOOST_TEST_EQUAL( 3, scale_power( 9, -999'999'999.0,
1'999'999'999.0));
+ BOOST_TEST_EQUAL( 3, scale_power( 9, 1'999'999'999.0,
-999'999'999.0));
}
void test_trimming()
- [lmi-commits] [lmi] master updated (566fa11 -> 232d118), Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master 50b6290 2/8: Add a failing unit test,
Greg Chicares <=
- [lmi-commits] [lmi] master ef76b1f 5/8: Fix the failing test just committed, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master 99c2c5e 7/8: Augment unit test and documentation, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master b282c3f 1/8: Add simple unit tests, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master 2f9e574 4/8: Add a failing unit test, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master f053d67 6/8: Reduce trickiness, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master a96528d 3/8: Fix the failing test just committed, Greg Chicares, 2018/03/17
- [lmi-commits] [lmi] master 232d118 8/8: Augment unit test, demonstrating the present algorithm's limitations, Greg Chicares, 2018/03/17