[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e8ba2cf 3/9: Move an ancient unit test of sor
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e8ba2cf 3/9: Move an ancient unit test of sorts |
Date: |
Sun, 4 Apr 2021 07:00:19 -0400 (EDT) |
branch: master
commit e8ba2cfc84f3f0b32bfad30e319bc3fd29c19502
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Move an ancient unit test of sorts
Historical note: RW was Rogue Wave, and OS was ObjectSpace (both were
mid-1990s STL vendors), so this code is older than libstdc++.
---
gpt_test.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ihs_irc7702.cpp | 58 ----------------------------------------------------
2 files changed, 63 insertions(+), 58 deletions(-)
diff --git a/gpt_test.cpp b/gpt_test.cpp
index 3a507fb..fac695d 100644
--- a/gpt_test.cpp
+++ b/gpt_test.cpp
@@ -204,12 +204,14 @@ class gpt_test
test_preconditions();
test_premium_calculations();
assay_speed();
+ test_ancient();
}
private:
static void test_preconditions();
static void test_premium_calculations();
static void assay_speed();
+ static void test_ancient();
static void initialize(int issue_age);
static gpt_vector_parms v_parms();
@@ -621,6 +623,67 @@ void gpt_test::assay_speed()
;
}
+void gpt_test::test_ancient()
+{
+// TAXATION !! TODO ?? This should be a separate, standalone unit test.
+#if 0
+
+#include "ihs_timer.hpp"
+
+#include <iomanip>
+#include <iostream>
+
+int main()
+{
+// TAXATION !! Update or remove these timings.
+// timing to construct Irc7702:
+// RW: about 37 msec
+// OS: about 93 msec; about 41 if we disable index checking
+// in std::vector operator[]()
+
+// SOA table 120: "1980 CSO 50% Male Age nearest"
+ std::vector<double>q
+ {
+ .00354,.00097,.00091,.00089,.00085,.00083,.00079,.00077,.00073,.00072,
+ .00071,.00072,.00078,.00087,.00097,.00110,.00121,.00131,.00139,.00144,
+ .00148,.00149,.00150,.00149,.00149,.00147,.00147,.00146,.00148,.00151,
+ .00154,.00158,.00164,.00170,.00179,.00188,.00200,.00214,.00231,.00251,
+ .00272,.00297,.00322,.00349,.00375,.00406,.00436,.00468,.00503,.00541,
+ .00583,.00630,.00682,.00742,.00807,.00877,.00950,.01023,.01099,.01181,
+ .01271,.01375,.01496,.01639,.01802,.01978,.02164,.02359,.02558,.02773,
+ .03016,.03296,.03629,.04020,.04466,.04955,.05480,.06031,.06606,.07223,
+ .07907,.08680,.09568,.10581,.11702,.12911,.14191,.15541,.16955,.18445,
+ .20023,.21723,.23591,.25743,.28381,.32074,.37793,.47661,.65644,1.0000,
+ };
+
+ std::vector<double>i (100, 0.07);
+ std::vector<double>LoadTgt (100, 0.05);
+ std::vector<double>MlyChgSpecAmt(100, 0.00);
+ std::vector<double>MlyChgADD (100, 0.00);
+ std::vector<double>PolFee (100, 5.00);
+
+ Timer timer;
+
+ Irc7702* Irc7702_ = ::new Irc7702
+ (CVAT
+ ,45
+ ,100000.0
+ ,Option1
+ ,q
+ ,i
+ ,LoadTgt
+ ,MlyChgSpecAmt
+ ,10000000.0
+ ,MlyChgADD
+ ,10000000.0
+ ,PolFee
+ );
+ std::cout << timer.stop().elapsed_msec_str();
+ delete Irc7702_;
+}
+#endif // 0
+}
+
int test_main(int, char*[])
{
gpt_test::test();
diff --git a/ihs_irc7702.cpp b/ihs_irc7702.cpp
index 30c84a8..623fdb1 100644
--- a/ihs_irc7702.cpp
+++ b/ihs_irc7702.cpp
@@ -858,61 +858,3 @@ double Irc7702::premiums_paid() const
{
return CumPmts;
}
-
-// TAXATION !! TODO ?? This should be a separate, standalone unit test.
-#if 0
-
-#include "ihs_timer.hpp"
-
-#include <iomanip>
-#include <iostream>
-
-int main()
-{
-// TAXATION !! Update or remove these timings.
-// timing to construct Irc7702:
-// RW: about 37 msec
-// OS: about 93 msec; about 41 if we disable index checking
-// in std::vector operator[]()
-
-// SOA table 120: "1980 CSO 50% Male Age nearest"
- std::vector<double>q
- {
- .00354,.00097,.00091,.00089,.00085,.00083,.00079,.00077,.00073,.00072,
- .00071,.00072,.00078,.00087,.00097,.00110,.00121,.00131,.00139,.00144,
- .00148,.00149,.00150,.00149,.00149,.00147,.00147,.00146,.00148,.00151,
- .00154,.00158,.00164,.00170,.00179,.00188,.00200,.00214,.00231,.00251,
- .00272,.00297,.00322,.00349,.00375,.00406,.00436,.00468,.00503,.00541,
- .00583,.00630,.00682,.00742,.00807,.00877,.00950,.01023,.01099,.01181,
- .01271,.01375,.01496,.01639,.01802,.01978,.02164,.02359,.02558,.02773,
- .03016,.03296,.03629,.04020,.04466,.04955,.05480,.06031,.06606,.07223,
- .07907,.08680,.09568,.10581,.11702,.12911,.14191,.15541,.16955,.18445,
- .20023,.21723,.23591,.25743,.28381,.32074,.37793,.47661,.65644,1.0000,
- };
-
- std::vector<double>i (100, 0.07);
- std::vector<double>LoadTgt (100, 0.05);
- std::vector<double>MlyChgSpecAmt(100, 0.00);
- std::vector<double>MlyChgADD (100, 0.00);
- std::vector<double>PolFee (100, 5.00);
-
- Timer timer;
-
- Irc7702* Irc7702_ = ::new Irc7702
- (CVAT
- ,45
- ,100000.0
- ,Option1
- ,q
- ,i
- ,LoadTgt
- ,MlyChgSpecAmt
- ,10000000.0
- ,MlyChgADD
- ,10000000.0
- ,PolFee
- );
- std::cout << timer.stop().elapsed_msec_str();
- delete Irc7702_;
-}
-#endif // 0
- [lmi-commits] [lmi] master updated (29b2ad4 -> dd6ee0a), Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master f05e4b4 8/9: Confirm correctness of guideline premium calculations, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master dd6ee0a 9/9: Improve documentation, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master e8ba2cf 3/9: Move an ancient unit test of sorts,
Greg Chicares <=
- [lmi-commits] [lmi] master f1ec209 1/9: Demonstrate that PETE has a non-zero overhead, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master c7eb277 7/9: Test guideline premium calculations with tiered premium loads, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master 812cf6b 5/9: Prepare to make an ancient unit test useful, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master 89ee2ec 6/9: Repurpose a unit test, Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master 336db06 4/9: Resurrect an ancient unit test [292], Greg Chicares, 2021/04/04
- [lmi-commits] [lmi] master 9b78c44 2/9: Remove a dead reference to an idea that seems silly anyway, Greg Chicares, 2021/04/04