[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master d14dd22 1/4: Rework temporary assertion for '
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master d14dd22 1/4: Rework temporary assertion for 'PolicyForm' |
Date: |
Sat, 14 Nov 2020 22:03:39 -0500 (EST) |
branch: master
commit d14dd22b5243b6861c83108aebca4a7aa85aa9dc
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rework temporary assertion for 'PolicyForm'
Asserted equality of 'PolicyForm' as determined by both methods (with
concomitant changes to all proprietary product files). Replaced the
assertion macro with a more informative alternative. Allowed the value
by the old method to equal "{PolicyForm}" because 'sample2*' products
set the value of drop-in text variables to the variable's name enclosed
in braces; perhaps the new method should reproduce that value.
Ultimately the old method and its underpinnings will be eradicated, and
the new method will be used for almost all of class product_data's data
members. For now, it is sufficient to demonstrate the new method with a
single data member, 'PolicyForm', which can now vary by state (among
other axes) in the simple and natural way shown in the last few lines
of sample::sample() in the current version of 'dbdict.cpp'.
---
ledger_invariant_init.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/ledger_invariant_init.cpp b/ledger_invariant_init.cpp
index a053241..1e2f582 100644
--- a/ledger_invariant_init.cpp
+++ b/ledger_invariant_init.cpp
@@ -327,12 +327,18 @@ void LedgerInvariant::Init(BasicValues const* b)
PolicyForm = p.datum(alt_form ? "PolicyFormAlternative" :
"PolicyForm");
- if("sample" == b->yare_input_.ProductName)
- {
- auto policy_form = b->database().query<int>(DB_PolicyForm);
- LMI_ASSERT(b->lingo_->lookup(policy_form) == PolicyForm);
- PolicyForm = b->lingo_->lookup(policy_form);
- }
+ auto policy_form = b->database().query<int>(DB_PolicyForm);
+ bool const policy_form_is_okay =
+ b->lingo_->lookup(policy_form) == PolicyForm
+ || "{PolicyForm}" == PolicyForm
+ ;
+ if(!policy_form_is_okay)
+ alarum()
+ << b->lingo_->lookup(policy_form) << "
b->lingo_->lookup(policy_form)\n"
+ << PolicyForm << " PolicyForm\n"
+ << LMI_FLUSH
+ ;
+ PolicyForm = b->lingo_->lookup(policy_form);
PolicyMktgName = p.datum("PolicyMktgName"
);
PolicyLegalName = p.datum("PolicyLegalName"
);