lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 19a4a3a 03/23: For now at least, trace solves


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 19a4a3a 03/23: For now at least, trace solves in regression test
Date: Tue, 27 Jul 2021 21:59:50 -0400 (EDT)

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

    For now at least, trace solves in regression test
    
    The marginal cost is slight, and the trace is useful as long as
    solves remain under investigation.
    
    Incidentally, for illustration solves, make the trace show the number
    of decimals specified for each solve, but never less than two in order
    to ensure that currency cents are always shown.
---
 ihs_avsolve.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index f6d8b9c..0ab7c85 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -34,6 +34,7 @@
 #include "assert_lmi.hpp"
 #include "contains.hpp"
 #include "death_benefits.hpp"
+#include "global_settings.hpp"
 #include "ledger_invariant.hpp"
 #include "ledger_variant.hpp"
 #include "mc_enum_types_aux.hpp"        // set_run_basis_from_cloven_bases()
@@ -457,7 +458,10 @@ currency AccountValue::Solve
 
     std::ostream os_trace(status().rdbuf());
     std::ofstream ofs_trace;
-    if(contains(yare_input_.Comments, "idiosyncrasyT"))
+    if
+        (  global_settings::instance().regression_testing()
+        || contains(yare_input_.Comments, "idiosyncrasyT")
+        )
         {
         ofs_trace.open("trace.txt", ios_out_app_binary());
         os_trace.rdbuf(ofs_trace.rdbuf());
@@ -472,6 +476,7 @@ currency AccountValue::Solve
             << ", target " << mc_str(SolveTarget_)
             << std::endl
             ;
+        os_trace << std::fixed << std::setprecision(std::max(2, decimals));
         }
 
     SolveHelper solve_helper(*this, solve_set_fn);



reply via email to

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