lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 44a42de 1/4: Assert that premium-tax rates ar


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 44a42de 1/4: Assert that premium-tax rates are up to date
Date: Thu, 7 Dec 2017 12:58:47 -0500 (EST)

branch: master
commit 44a42de04148f0240297a287d8ce350055de365f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Assert that premium-tax rates are up to date
    
    * premium_tax.cpp: Assert.
    * test_coding_rules.cpp: Allow assertion to use __DATE__.
    
    This could have been done in a makefile, but then each yearly update
    would require changing the makefile as well as the source code.
    
    This commit breaks the build today because the AZ rate has not yet been
    updated; it will be updated before this commit is pushed.
---
 premium_tax.cpp       | 33 +++++++++++++++++++++++++--------
 test_coding_rules.cpp |  1 +
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/premium_tax.cpp b/premium_tax.cpp
index 82ea283..8e2076a 100644
--- a/premium_tax.cpp
+++ b/premium_tax.cpp
@@ -357,6 +357,31 @@ double premium_tax::calculate_load(double payment, 
stratified_charges const& str
     return z;
 }
 
+/// Suggest updating rates each year.
+///
+/// AZ rates vary by calendar year:
+///   
https://insurance.az.gov/sites/default/files/documents/files/RegulatoryBulletin2016-02_20160705.pdf
+///   2017 0.0190
+///   2018 0.0185
+///   2019 0.0180
+///   2020 0.0175
+///   2021 0.0170
+///
+/// Without this assertion, it's too easy to forget to update this
+/// rate when building lmi in December for release in January. Each
+/// year, expunge the particular assertion that failed, after updating
+/// the AZ rate manually. It is better not to make the rate update
+/// itself automatically because the schedule of future rates may have
+/// changed in the meantime (and actually did, in the 20170508T1544Z
+/// commit). Expunge this block comment when the last assertion is
+/// expunged.
+
+static_assert('D' != __DATE__[0] || '7' != __DATE__[10]);
+static_assert('D' != __DATE__[0] || '8' != __DATE__[10]);
+static_assert('D' != __DATE__[0] || '9' != __DATE__[10]);
+static_assert('D' != __DATE__[0] || '0' != __DATE__[10]);
+static_assert('D' != __DATE__[0] || '1' != __DATE__[10]);
+
 /// Premium-tax rates for life insurance without retaliation.
 ///
 /// A single table suffices for every domicile, because retaliation is
@@ -369,14 +394,6 @@ double premium_tax::calculate_load(double payment, 
stratified_charges const& str
 ///
 /// Fictitious state XX may be used where no premium tax applies, as
 /// for offshore business.
-///
-/// AZ rates:
-///   
https://insurance.az.gov/sites/default/files/documents/files/RegulatoryBulletin2016-02_20160705.pdf
-///   2017 0.0190
-///   2018 0.0185
-///   2019 0.0180
-///   2020 0.0175
-///   2021 0.0170
 
 std::vector<double> const& premium_tax_rates_for_life_insurance()
 {
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index b7f5c36..57f54ae 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -846,6 +846,7 @@ bool check_reserved_name_exception(std::string const& s)
         ,"_IOFBF"
         ,"_IOLBF"
         ,"_IONBF"
+        ,"__DATE__"
         ,"__FILE__"
         ,"__LINE__"
         ,"__STDC_IEC_559__"



reply via email to

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