[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master accb867 2/2: Add 'test_coding_rules' to the l
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master accb867 2/2: Add 'test_coding_rules' to the list of default targets |
Date: |
Tue, 4 Jun 2019 09:42:06 -0400 (EDT) |
branch: master
commit accb86719780a77e734209b9d744d9bc3c568df3
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add 'test_coding_rules' to the list of default targets
'hooks/pre-commit' fails if the 'test_coding_rules' binary is out of
date. That doesn't happen if 'make check_concinnity' is run before every
commit, but doing so optional (the hook does it anyway). However, it is
reasonable to expect that either 'make install' or 'make all' has been
run before any commit, to ensure that the changes compile; those targets
now ensure that this binary is up to date.
Reverted commit b30b5db803, which has been rendered unnecessary.
Alternative not chosen: adding this line
make --directory=/opt/lmi/src/lmi custom_tools 2>&1 >/dev/null
to 'hooks/pre-commit' would ensure that the required binary has always
been built before it's needed. However, that hook already takes about
five and a half seconds, and it would take seven seconds with such a
change. The extra 'make' invocation seems too costly for a git hook.
The chosen solution has a lower incremental cost (adding a dependency
doesn't require reentering the top-level makefile), and 'make all' need
not be as fast as a hook script.
---
install_msw.sh | 1 -
verify_products.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++--
workhorse.make | 1 +
3 files changed, 83 insertions(+), 3 deletions(-)
diff --git a/install_msw.sh b/install_msw.sh
index fc72f74..a5f3183 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -279,7 +279,6 @@ do
make $coefficiency --output-sync=recurse show_flags
make $coefficiency --output-sync=recurse clean
make $coefficiency --output-sync=recurse install
- make $coefficiency --output-sync=recurse custom_tools
if [ "Cygwin" = "$platform" ]
then
diff --git a/verify_products.cpp b/verify_products.cpp
index 38dec9d..d56097c 100644
--- a/verify_products.cpp
+++ b/verify_products.cpp
@@ -24,11 +24,13 @@
#include "verify_products.hpp"
#include "actuarial_table.hpp"
+//#include "assert_lmi.hpp"
#include "ce_product_name.hpp"
#include "cso_table.hpp"
#include "data_directory.hpp" // AddDataDir()
#include "database.hpp"
#include "input.hpp"
+#include "irc7702_tables.hpp"
#include "mc_enum.hpp" // all_strings<>()
#include "product_data.hpp"
#include "ssize_lmi.hpp"
@@ -83,7 +85,7 @@ void verify_one_cell
if(v0 == v1)
{
std::cout
- << "okay: table " << t
+ << "7702 q okay: table " << t
<< ' ' << gender
<< ' ' << smoking
<< std::endl
@@ -92,7 +94,7 @@ void verify_one_cell
else
{
std::cout
- << "PROBLEM: " << product_name
+ << "7702 q PROBLEM: " << product_name
<< ' ' << gender
<< ' ' << smoking
<< std::endl
@@ -113,6 +115,84 @@ void verify_one_cell
<< std::endl
;
}
+
+// CvatCorridorFilename
+// DB_CorridorTable
+ std::string const f7pp = AddDataDir(p.datum("SevenPayFilename"));
+ auto const t7pp = db.query<int> (DB_SevenPayTable);
+ if(!t7pp)
+ {
+ std::cout
+ << "7pp table 0: " << product_name
+ << ' ' << gender
+ << ' ' << smoking
+ << std::endl
+ ;
+ return;
+ }
+ actuarial_table const a7pp(f7pp, t7pp);
+ std::vector<double> const v1_7pp = a7pp.values
+ (a7pp.min_age()
+ ,1 + a7pp.max_age() - a7pp.min_age()
+ );
+
+ if(db.query<int>(DB_MinIssAge ) != a7pp.min_age())
+ std::cout << " 7pp table " << t7pp << ": min age discrepancy" <<
std::endl;
+ if(db.query<int>(DB_MaturityAge) != 1 + a7pp.max_age())
+ std::cout << " 7pp table " << t7pp << ": max age discrepancy" <<
std::endl;
+
+ std::vector<double> ig;
+ db.query_into(DB_NaarDiscount, ig);
+ irc7702_tables z
+ (era
+ ,oe_orthodox
+ ,a_b
+ ,mce_gender (gender).value()
+ ,mce_smoking(smoking).value()
+ ,ig
+ ,1.0 / db.query<double>(DB_MaxMonthlyCoiRate)
+ ,a7pp.min_age()//,db.query<int >(DB_MinIssAge)
+ ,1 + a7pp.max_age()//,db.query<int >(DB_MaturityAge)
+ );
+// std::vector<double> const& ul_corr = z.ul_corr();
+// std::vector<double> const& ul_7pp = z.ul_7pp ();
+// std::vector<double> const& ol_corr = z.ol_corr();
+ std::vector<double> const& ol_7pp = z.ol_7pp ();
+
+ std::cout
+ << "7pp table " << t7pp
+ << ' ' << lmi::ssize(v1_7pp)
+ << ' ' << lmi::ssize(ol_7pp)
+ << ' ' << ((lmi::ssize(v1_7pp) != lmi::ssize(ol_7pp)) ? "DIFF" :
"SAME")
+ << std::endl
+ ;
+ int length = std::min(lmi::ssize(ol_7pp), lmi::ssize(v1_7pp));
+// LMI_ASSERT(lmi::ssize(ol_7pp) == lmi::ssize(v1_7pp));
+ for(int j = 0; j < length; ++j)
+ {
+ if(v1_7pp[j] <= ol_7pp[j])
+ continue;
+ std::cout
+ << "7pp error:"
+ << " table " << t7pp
+ << ' ' << product_name
+ << ' ' << gender
+ << ' ' << smoking
+ << " omega " << 1 + a7pp.max_age()
+ << std::endl
+ << " dur " << j
+ << " tabular " << v1_7pp[j]
+ << " exceeds calculated " << ol_7pp[j]
+ << std::endl
+ ;
+ return;
+ }
+ std::cout
+ << "7pp okay: table " << t7pp
+ << ' ' << gender
+ << ' ' << smoking
+ << std::endl
+ ;
}
} // Unnamed namespace.
diff --git a/workhorse.make b/workhorse.make
index 7bd2885..c952e39 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -115,6 +115,7 @@ ifeq (,$(USE_SO_ATTRIBUTES))
generate_passkey$(EXEEXT) \
ihs_crc_comp$(EXEEXT) \
rate_table_tool$(EXEEXT) \
+ test_coding_rules$(EXEEXT) \
ifneq (so_test,$(findstring so_test,$(build_type)))
default_targets += \