lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 87af00c 19/25: Support a further "refactoring


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 87af00c 19/25: Support a further "refactoring"
Date: Wed, 24 Feb 2021 19:00:54 -0500 (EST)

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

    Support a further "refactoring"
    
    This resembles other recent refactorings, but its assertions do not
    prove that the code to be retired is equivalent to its replacement:
    it cannot be, because one ignores loan rates unconditionally while the
    other does not. It passes regression tests only because such tests are
    very limited for '.mec' input files. The '.gpt' testcases are better,
    but they bypass this code because test_one_days_gpt_transactions()
    returns early.
    
    Any inequivalence is however accidental: the code that will soon be
    removed here (#if 1...endif // 1) was intended to be a faithful copy
    of the more authoritative code that has become class i7702, so the
    forthcoming replacement will actually be an improvement rather than
    a refactoring.
---
 gpt_server.cpp | 9 ++++++++-
 mec_server.cpp | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gpt_server.cpp b/gpt_server.cpp
index 510211f..221d64b 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -38,7 +38,7 @@
 #include "ieee754.hpp"                  // ldbl_eps_plus_one_times()
 #include "ihs_irc7702a.hpp"
 #include "ihs_server7702.hpp"           // RunServer7702FromStruct()
-#include "irc7702_interest.hpp"         // iglp(), igsp()
+#include "irc7702_interest.hpp"
 #include "materially_equal.hpp"         // material_difference()
 #include "math_functions.hpp"
 #include "mc_enum_types_aux.hpp"        // mc_state_from_string()
@@ -185,6 +185,7 @@ gpt_state test_one_days_gpt_transactions
     max_coi_rate = 1.0 / max_coi_rate;
     assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
+#if 1
     std::vector<double> guar_int;
     database.query_into(DB_GuarInt, guar_int);
 
@@ -218,6 +219,12 @@ gpt_state test_one_days_gpt_transactions
         ? zero
         : Mly7702iGlp
         ;
+#endif // 1
+    i7702 const i7702_(database, stratified);
+    LMI_ASSERT(i7702_.gross  () == Mly7702ig);
+    LMI_ASSERT(i7702_.net_glp() == Mly7702iGlp);
+//  LMI_ASSERT(i7702_.net_gsp() == Mly7702iGsp);
+    LMI_ASSERT(i7702_.spread () == spread);
     ULCommFns commfns
         (Mly7702qc
         ,Mly7702iGlp
diff --git a/mec_server.cpp b/mec_server.cpp
index 20a6700..4431688 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -35,7 +35,7 @@
 #include "et_vector.hpp"
 #include "ieee754.hpp"                  // ldbl_eps_plus_one_times()
 #include "ihs_irc7702a.hpp"
-#include "irc7702_interest.hpp"         // iglp()
+#include "irc7702_interest.hpp"
 #include "materially_equal.hpp"         // material_difference()
 #include "math_functions.hpp"
 #include "mc_enum_types_aux.hpp"        // mc_state_from_string()
@@ -168,6 +168,7 @@ mec_state test_one_days_7702A_transactions
     max_coi_rate = 1.0 / max_coi_rate;
     assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
+#if 1
     std::vector<double> guar_int;
     database.query_into(DB_GuarInt, guar_int);
 
@@ -199,6 +200,12 @@ mec_state test_one_days_7702A_transactions
         ? zero
         : Mly7702iGlp
         ;
+#endif // 1
+    i7702 const i7702_(database, stratified);
+    LMI_ASSERT(i7702_.gross  () == Mly7702ig);
+    LMI_ASSERT(i7702_.net_glp() == Mly7702iGlp);
+//  LMI_ASSERT(i7702_.net_gsp() == Mly7702iGsp);
+    LMI_ASSERT(i7702_.spread () == spread);
     ULCommFns commfns
         (Mly7702qc
         ,Mly7702iGlp



reply via email to

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