lmi-commits
[Top][All Lists]
Advanced

[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



reply via email to

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