lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master ba4355f4 3/5: Restructure unit test to minimi


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ba4355f4 3/5: Restructure unit test to minimize friendships
Date: Thu, 27 Jan 2022 15:26:07 -0500 (EST)

branch: master
commit ba4355f42784ee591fabcb02f51fed63be4684b2
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Restructure unit test to minimize friendships
---
 irc7702_tables.hpp      |  5 +----
 irc7702_tables_test.cpp | 31 +++++++++++++++++++++++--------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/irc7702_tables.hpp b/irc7702_tables.hpp
index e2fb79af..5dc64e5c 100644
--- a/irc7702_tables.hpp
+++ b/irc7702_tables.hpp
@@ -32,10 +32,7 @@
 
 class LMI_SO irc7702_tables final
 {
-    friend void Test_Corridor_and_7PP();
-    friend void Test_1980_CSO();
-    friend void Test_2001_CSO();
-    friend void Test_2017_CSO();
+    friend class irc7702_tables_test;
 
   public:
     irc7702_tables
diff --git a/irc7702_tables_test.cpp b/irc7702_tables_test.cpp
index 4b7a9d35..73df722b 100644
--- a/irc7702_tables_test.cpp
+++ b/irc7702_tables_test.cpp
@@ -34,6 +34,24 @@
 #include <cmath>                        // log()
 #include <vector>
 
+class irc7702_tables_test
+{
+  public:
+    static void test()
+        {
+        test_corridor_and_7pp();
+        test_1980_cso();
+        test_2001_cso();
+        test_2017_cso();
+        }
+
+  private:
+    static void test_corridor_and_7pp();
+    static void test_1980_cso();
+    static void test_2001_cso();
+    static void test_2017_cso();
+};
+
 // These two arrays are pasted from the "corridor mult" and "7Pt"
 // columns of 'validate_2001cso', after loading that spreadsheet
 // in 'gnumeric' and formatting those columns to twenty decimals.
@@ -454,7 +472,7 @@ static double const ss_ol_7pp[100] =
 
 /// Test CVAT corridor and seven-pay premium.
 
-void Test_Corridor_and_7PP()
+void irc7702_tables_test::test_corridor_and_7pp()
 {
     double constexpr iglp = 0.04;
     std::vector<double> const operative_i(100, iglp);
@@ -990,7 +1008,7 @@ static std::vector<cf_data> const olcf_2017_cso_endt_95 =
 // OL commutation functions. They match the 'OLCF_CSO' spreadsheet's
 // values very closely.
 
-void Test_1980_CSO()
+void irc7702_tables_test::test_1980_cso()
 {
     int constexpr endt_age = 100;
     double constexpr iglp = 0.04;
@@ -1034,7 +1052,7 @@ void Test_1980_CSO()
         ;
 }
 
-void Test_2001_CSO()
+void irc7702_tables_test::test_2001_cso()
 {
     int constexpr endt_age = 100;
     double constexpr iglp = 0.04;
@@ -1078,7 +1096,7 @@ void Test_2001_CSO()
         ;
 }
 
-void Test_2017_CSO()
+void irc7702_tables_test::test_2017_cso()
 {
     int constexpr endt_age = 95;
     double constexpr iglp = 0.02;
@@ -1124,10 +1142,7 @@ void Test_2017_CSO()
 
 int test_main(int, char*[])
 {
-    Test_Corridor_and_7PP();
-    Test_1980_CSO();
-    Test_2001_CSO();
-    Test_2017_CSO();
+    irc7702_tables_test::test();
 
     return EXIT_SUCCESS;
 }



reply via email to

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