[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master b8f43e0 06/14: Transpose several unit-test fu
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master b8f43e0 06/14: Transpose several unit-test functions |
Date: |
Mon, 5 Apr 2021 18:26:46 -0400 (EDT) |
branch: master
commit b8f43e00b9690f76e1c8c4684f5e1591c740d7c8
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Transpose several unit-test functions
---
commutation_functions_test.cpp | 98 +++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/commutation_functions_test.cpp b/commutation_functions_test.cpp
index fc2ed62..ed8a162 100644
--- a/commutation_functions_test.cpp
+++ b/commutation_functions_test.cpp
@@ -53,42 +53,6 @@ std::vector<double> const& sample_q()
}
} // Unnamed namespace.
-void mete_olcf
- (std::vector<double> const& q
- ,std::vector<double> const& i
- )
-{
- for(int j = 0; j < 100; ++j)
- {
- volatile auto z = OLCommFns(q, i);
- }
-}
-
-void mete_ulcf
- (std::vector<double> const& q
- ,std::vector<double> const& ic
- ,std::vector<double> const& ig
- )
-{
- for(int j = 0; j < 100; ++j)
- {
- volatile auto z = ULCommFns(q, ic, ig, mce_option1_for_7702,
mce_monthly);
- }
-}
-
-void mete_reserve
- (ULCommFns const& ulcf
- ,std::vector<double>& reserve
- )
-{
- for(int j = 0; j < 100; ++j)
- {
- volatile double premium = (10.0 * ulcf.aDomega() + ulcf.kM()[0]) /
ulcf.aN()[0];
- reserve <<= premium * ulcf.aD() - ulcf.kC();
- reserve <<= fwd_sum(reserve) / ulcf.EaD();
- }
-}
-
/// Exactly reproduce Table 2 from Eckley's paper.
///
/// Table 2 on pages 25-26 of TSA XXIX uses annual functions, and
@@ -675,6 +639,55 @@ void Test_1980_CSO_Male_ANB()
;
}
+/// Test UL commutation functions in extreme cases.
+///
+/// For example, ic and ig can both be zero, and qc may round to zero
+/// for a Frasierized survivorship contract.
+
+void TestLimits()
+{
+ std::vector<double> zero(10, 0.0);
+ ULCommFns ulcf(zero, zero, zero, mce_option1_for_7702, mce_monthly);
+ LMI_TEST_EQUAL(1.0, ulcf.aDomega());
+ LMI_TEST_EQUAL(0.0, ulcf.kC().back());
+}
+
+void mete_olcf
+ (std::vector<double> const& q
+ ,std::vector<double> const& i
+ )
+{
+ for(int j = 0; j < 100; ++j)
+ {
+ volatile auto z = OLCommFns(q, i);
+ }
+}
+
+void mete_ulcf
+ (std::vector<double> const& q
+ ,std::vector<double> const& ic
+ ,std::vector<double> const& ig
+ )
+{
+ for(int j = 0; j < 100; ++j)
+ {
+ volatile auto z = ULCommFns(q, ic, ig, mce_option1_for_7702,
mce_monthly);
+ }
+}
+
+void mete_reserve
+ (ULCommFns const& ulcf
+ ,std::vector<double>& reserve
+ )
+{
+ for(int j = 0; j < 100; ++j)
+ {
+ volatile double premium = (10.0 * ulcf.aDomega() + ulcf.kM()[0]) /
ulcf.aN()[0];
+ reserve <<= premium * ulcf.aD() - ulcf.kC();
+ reserve <<= fwd_sum(reserve) / ulcf.EaD();
+ }
+}
+
void assay_speed()
{
std::vector<double> q(sample_q());
@@ -700,19 +713,6 @@ void assay_speed()
;
}
-/// Test UL commutation functions in extreme cases.
-///
-/// For example, ic and ig can both be zero, and qc may round to zero
-/// for a Frasierized survivorship contract.
-
-void TestLimits()
-{
- std::vector<double> zero(10, 0.0);
- ULCommFns ulcf(zero, zero, zero, mce_option1_for_7702, mce_monthly);
- LMI_TEST_EQUAL(1.0, ulcf.aDomega());
- LMI_TEST_EQUAL(0.0, ulcf.kC().back());
-}
-
int test_main(int, char*[])
{
ULCommFnsTest();
- [lmi-commits] [lmi] master updated (dd6ee0a -> 8aa09b9), Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 40218dc 03/14: Factor out commutation-function speed tests, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master b8f43e0 06/14: Transpose several unit-test functions,
Greg Chicares <=
- [lmi-commits] [lmi] master e6ed669 01/14: Test guideline premium calculations with more complications, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master b1eecea 02/14: Stabilize unit-test timing, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 28cabc2 04/14: Prefer lambdas to std::bind(), Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 61a04eb 08/14: Make commutation functions default constructible, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master df25463 12/14: Avoid operator new, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master b657767 13/14: Remove conditionals that serve no further purpose, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 23fe71f 11/14: Do away with an undesirable smart pointer [290], Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 485e19b 07/14: Favor the rule of zero, Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master 762056e 05/14: Prefer PETE's operator<<=() to assign(), Greg Chicares, 2021/04/05
- [lmi-commits] [lmi] master ed251fc 09/14: Test implicit special member functions, Greg Chicares, 2021/04/05