[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 39f76e4 4/8: Make a deliberate mistake more o
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 39f76e4 4/8: Make a deliberate mistake more obvious in a unit test |
Date: |
Wed, 7 Nov 2018 17:11:10 -0500 (EST) |
branch: master
commit 39f76e4c109046ee7c06710a22295c9e970f278c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Make a deliberate mistake more obvious in a unit test
Treating DB_MaturityAge as type oenum_alb_or_anb looked plausibly
accidental, because it is not altogether unreasonable to say that
"maturity age" is "age last birthday". Treating DB_ChildRiderMinAmt
as that type is more easily seen as deliberately mistaken: to say
that a rider's minimum amount is "age last birthday" is clearly
nonsensical.
---
input_test.cpp | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/input_test.cpp b/input_test.cpp
index 16e817f..bba9bbc 100644
--- a/input_test.cpp
+++ b/input_test.cpp
@@ -153,17 +153,19 @@ void input_test::test_product_database()
oenum_alb_or_anb a;
+ // Test query<enumerative type> with non-enumerative entities.
+
// This value corresponds to no enumerator, but C++ allows that.
- db.query_into(DB_MaturityAge, a);
- BOOST_TEST_EQUAL(100, a);
- auto const b {db.query<oenum_alb_or_anb>(DB_MaturityAge)};
- BOOST_TEST_EQUAL(100, b);
+ db.query_into(DB_ChildRiderMinAmt, a);
+ BOOST_TEST_EQUAL(25000, a);
+ auto const b {db.query<oenum_alb_or_anb>(DB_ChildRiderMinAmt)};
+ BOOST_TEST_EQUAL(25000, b);
// Redundant template argument is okay.
- db.query_into<oenum_alb_or_anb>(DB_MaturityAge, a);
+ db.query_into<oenum_alb_or_anb>(DB_ChildRiderMinAmt, a);
// Fails to compile with wrong template argument:
-// db.query_into<float>(DB_MaturityAge, a);
-// db.query_into<bool >(DB_MaturityAge, a);
+// db.query_into<float>(DB_ChildRiderMinAmt, a);
+// db.query_into<bool >(DB_ChildRiderMinAmt, a);
// This value is not integral, so bourn_cast rejects it.
BOOST_TEST_THROW
- [lmi-commits] [lmi] master updated (259f97c -> 6c72fcf), Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 284339d 1/8: Document boolean database entities more uniformly, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master e4a6ba2 6/8: Use query<bool> with database entities that are inherently boolean, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 39f76e4 4/8: Make a deliberate mistake more obvious in a unit test,
Greg Chicares <=
- [lmi-commits] [lmi] master f066478 7/8: Use query<T> with database entities that are inherently enumerative, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 6c72fcf 8/8: Use query<double> with database entities that are inherently floating, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 5e009d6 3/8: Adjust whitespace to improve vertical alignment, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 28105c5 5/8: Use query<int> with database entities that are inherently int, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 9490b4c 2/8: Avoid using floating-point constants for boolean values, Greg Chicares, 2018/11/07