[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
- [lmi-commits] [lmi] master e6f9397 14/25: Obtain DCV interest rate from i7702 object, (continued)
- [lmi-commits] [lmi] master e6f9397 14/25: Obtain DCV interest rate from i7702 object, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master d17fda2 20/25: Bring bogosity into focus before eradicating it, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master bbe2802 21/25: Reduce bogosity ever so slightly, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 8c27092 24/25: Use correct interest rates for '.mec' input, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 7cf8204 02/25: Add a 7702 interest-rate class, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ef22f46 07/25: Deduplicate [295], Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 6bde573 12/25: Make certain shared_ptr members const, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ee8667d 13/25: Turn a local variable into a member, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 9f5c39d 15/25: Expunge disused accessors, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 8db602c 16/25: Turn several members into local variables, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 87af00c 19/25: Support a further "refactoring",
Greg Chicares <=
- [lmi-commits] [lmi] master ad762d4 18/25: Remove dead code, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ec7093b 22/25: Eradicate global iglp() and igsp(), Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master bf5f2ba 23/25: Eradicate bogosity, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 84ea017 11/25: Localize 7702 spread in class BasicValues, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3a395bc 17/25: Use new rather than old code, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master d4562c7 09/25: Remove dead code [294], Greg Chicares, 2021/02/24