[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/test_all_products 53f77a1 2/2: Test every produc
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/test_all_products 53f77a1 2/2: Test every product in every jurisdiction |
Date: |
Sun, 15 Nov 2020 16:39:13 -0500 (EST) |
branch: odd/test_all_products
commit 53f77a174e878a13948d0b5451051476aae3720d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Test every product in every jurisdiction
* ihs_acctval.cpp: Repair a problem instead of complaining about it.
* main_cli.cpp: Run an illustration for every product in every
jurisdiction.
This implementation is casual, but it's needed now for acceptance
testing of changes in proprietary product files. A careful
reimplementation may be added to 'master' later. Beware: this takes
about ten minutes with about 130 products, on an E5-2630 v3 machine.
Threading would be most beneficial.
---
ihs_acctval.cpp | 16 ++++------------
main_cli.cpp | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 98851dc..32a2062 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -544,22 +544,14 @@ void AccountValue::SetInitialValues()
if(!database().query<bool>(DB_AllowGenAcct) && 0.0 !=
GenAcctPaymentAllocation)
{
- alarum()
- << "No general account is allowed for this product, but "
- << GenAcctPaymentAllocation
- << " is allocated to the general account."
- << LMI_FLUSH
- ;
+ SepAcctPaymentAllocation = 1.0;
+ GenAcctPaymentAllocation = 0.0;
}
if(!database().query<bool>(DB_AllowSepAcct) && 0.0 !=
SepAcctPaymentAllocation)
{
- alarum()
- << "No separate account is allowed for this product, but "
- << SepAcctPaymentAllocation
- << " is allocated to the separate account."
- << LMI_FLUSH
- ;
+ SepAcctPaymentAllocation = 0.0;
+ GenAcctPaymentAllocation = 1.0;
}
MaxLoan = 0.0;
diff --git a/main_cli.cpp b/main_cli.cpp
index 67639ea..272ccdd 100644
--- a/main_cli.cpp
+++ b/main_cli.cpp
@@ -29,6 +29,7 @@
#include "getopt.hpp"
#include "global_settings.hpp"
#include "gpt_server.hpp"
+#include "handle_exceptions.hpp"
#include "illustrator.hpp"
#include "input.hpp"
#include "ledger.hpp"
@@ -166,6 +167,39 @@ void self_test()
<< std::endl
;
#endif // !defined _GLIBCXX_DEBUG
+
+ // Custom test: iterate over all products and states, in order
+ // to validate that two methods produce the same 'PolicyForm'.
+
+ // Allow unapproved states.
+ global_settings::instance().set_regression_testing(true);
+
+ // Pay zero and don't solve, to make this test go faster.
+ Input input;
+ input["Payment" ] = "0.0";
+ input["SolveType" ] = "No solve";
+
+ ce_product_name c;
+ std::vector<std::string> const& p = c.all_strings();
+ std::vector<std::string> const& s = all_strings_state();
+ for(auto const& i : p)
+ {
+ std::cout << i << std::endl;
+ input["ProductName" ] = i;
+ for(auto const& j : s)
+ {
+ input["StateOfJurisdiction"] = j;
+ try
+ {
+ z("eraseme", input);
+ }
+ catch(...)
+ {
+ std::cout << i << ", " << j << ":" << std::endl;
+ report_exception();
+ }
+ }
+ }
}
/// Run self-test repeatedly (intended for use with 'gprof').