lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 60b5d97 2/6: Strenghen asserted preconditions


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 60b5d97 2/6: Strenghen asserted preconditions
Date: Thu, 22 Apr 2021 11:57:25 -0400 (EDT)

branch: master
commit 60b5d97bb4545b0af4206a31fb7ab2475face4d6
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Strenghen asserted preconditions
---
 gpt_cf_triad_test.cpp         | 10 ++++++++++
 gpt_commutation_functions.cpp |  9 +++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gpt_cf_triad_test.cpp b/gpt_cf_triad_test.cpp
index 4099e3c..e55bdcd 100644
--- a/gpt_cf_triad_test.cpp
+++ b/gpt_cf_triad_test.cpp
@@ -365,6 +365,16 @@ void gpt_cf_triad_test::test_preconditions()
         );
     parms = s_parms(); // Reset.
 
+    // Endowment benefit greater than (f)(3) benefit.
+    parms.endt_bft = 100000.0;
+    parms.f3_bft   =  90000.0;
+    LMI_TEST_THROW
+        (z.calculate_premium(oe_gsp, mce_option1_for_7702, parms)
+        ,std::runtime_error
+        ,""
+        );
+    parms = s_parms(); // Reset.
+
     // Monthly q shorter than other vector parameters.
     q_m.resize(99);
     LMI_TEST_THROW(instantiate_cf(), std::runtime_error, "");
diff --git a/gpt_commutation_functions.cpp b/gpt_commutation_functions.cpp
index 0007e21..8f74687 100644
--- a/gpt_commutation_functions.cpp
+++ b/gpt_commutation_functions.cpp
@@ -221,8 +221,11 @@ gpt_cf_triad::gpt_cf_triad
 /// but then sometimes one would need to be thrown away (as when
 /// specified amount is determined by a GLP or GSP strategy).
 ///
-/// Asserted preconditions: Duration is within its natural bounds, and
-/// other members of 'args' are nonnegative.
+/// Asserted preconditions: 'duration' is within its natural bounds;
+/// other members of 'args' are nonnegative, including 'gross_1035'
+/// even though it isn't used here (because it's so easy to test),
+/// but excluding inforce amounts (which can be negative); and the
+/// endowment benefit does not exceed the (f)(3) benefit.
 ///
 /// Asserted postcondition: Returned GLP or GSP is nonnegative; thus,
 /// while adjusted premium 'A+B-C' may be negative, {A,B,C} are all
@@ -240,12 +243,14 @@ double gpt_cf_triad::calculate_premium
     LMI_ASSERT(0.0 <= args.endt_bft      );
     LMI_ASSERT(0.0 <= args.target_prem   );
     LMI_ASSERT(0.0 <= args.chg_sa_base   );
+    LMI_ASSERT(0.0 <= args.gross_1035    );
     LMI_ASSERT(0.0 <= args.qab_gio_amt   );
     LMI_ASSERT(0.0 <= args.qab_adb_amt   );
     LMI_ASSERT(0.0 <= args.qab_term_amt  );
     LMI_ASSERT(0.0 <= args.qab_spouse_amt);
     LMI_ASSERT(0.0 <= args.qab_child_amt );
     LMI_ASSERT(0.0 <= args.qab_waiver_amt);
+    LMI_ASSERT(args.endt_bft <= args.f3_bft);
 
     gpt_commfns const& cf =
           (oe_glp == glp_or_gsp && mce_option1_for_7702 == dbo) ? cf_glp_dbo_1



reply via email to

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