lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 0ea441a 07/13: Verify both DB_Irc7702QWhence


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0ea441a 07/13: Verify both DB_Irc7702QWhence cases
Date: Sat, 15 Jun 2019 20:25:36 -0400 (EDT)

branch: master
commit 0ea441ac6a16e90b77d5aedded5c4d4a5ec73417
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Verify both DB_Irc7702QWhence cases
---
 verify_products.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/verify_products.cpp b/verify_products.cpp
index a6bc78e..ec6d6c6 100644
--- a/verify_products.cpp
+++ b/verify_products.cpp
@@ -24,6 +24,7 @@
 #include "verify_products.hpp"
 
 #include "actuarial_table.hpp"
+#include "basic_tables.hpp"
 #include "ce_product_name.hpp"
 #include "cso_table.hpp"
 #include "data_directory.hpp"           // AddDataDir()
@@ -62,6 +63,9 @@ void verify_one_cell
     auto const t      = db.query<int             >(DB_Irc7702QTable);
     auto const axis_g = db.query<bool            >(DB_Irc7702QAxisGender);
     auto const axis_s = db.query<bool            >(DB_Irc7702QAxisSmoking);
+    auto const omega  = db.query<int             >(DB_MaturityAge);
+
+    int const years_to_maturity = omega - min_age;
 
     product_data const p(product_name);
 
@@ -73,9 +77,52 @@ void verify_one_cell
 
     switch(db.query<oenum_7702_q_whence>(DB_Irc7702QWhence))
         {
+        // Validate irc_7702_q_builtin(), which is implemented in
+        // terms of cso_table(). The interface of irc_7702_q()
+        // (which delegates to irc_7702_q_builtin()) specifies the
+        // [begin, end) age interval, so cso_table() is called with
+        // those arguments here. Passing this test means only that
+        // the irc_7702_q_builtin() logic is correct; the correctness
+        // of cso_table() is established elsewhere.
+        //
+        // This will fail for a product that incorrectly specifies a
+        // minimum age of zero for smoker-distinct CSO tables, which
+        // never begin at age zero.
         case oe_7702_q_builtin:
             {
+            std::vector<double> const v0 = cso_table
+                (era
+                ,oe_orthodox // No other option currently supported for 7702.
+                ,a_b
+                ,mce_gender (gender).value()
+                ,mce_smoking(smoking).value()
+                ,min_age
+                ,omega
+                );
+            std::vector<double> const v1 = irc_7702_q
+                (p
+                ,db
+                ,min_age
+                ,years_to_maturity
+                );
+            std::cout
+                << "7702 q okay: builtin "
+                << std::string((v0 == v1) ? "validated" : "PROBLEM")
+                << ' ' << gender
+                << ' ' << smoking
+                << std::endl
+                ;
+            return;
             }
+        // Validate an external table. Passing this test means that
+        // the external table is identical to the published CSO table,
+        // and that the external table can be discarded and its
+        // internal equivalent used instead. This is stricter than
+        // necessary: a product with an age range of [20, 95) could
+        // use an external table containing values only in that range;
+        // but it would be foolish to fabricate such a table when the
+        // full published table is available, as errors have been
+        // known to occur in fabrication.
         case oe_7702_q_external_table:
             {
             if(0 == t)
@@ -137,6 +184,7 @@ void verify_one_cell
                     << std::endl
                     ;
                 }
+            return;
             }
         }
 }



reply via email to

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