[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master cb5e424 11/15: Resolve several marked defects
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master cb5e424 11/15: Resolve several marked defects [308] |
Date: |
Sun, 14 Feb 2021 18:24:54 -0500 (EST) |
branch: master
commit cb5e424f283bf01efad16bd909a8c572e5a1291b
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Resolve several marked defects [308]
The next commit will remove the assertions that have been outdented to
the left margin.
---
interest_rates.cpp | 54 +++++++++++++++---------------------------------------
1 file changed, 15 insertions(+), 39 deletions(-)
diff --git a/interest_rates.cpp b/interest_rates.cpp
index 17a1fd3..7658448 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -316,16 +316,9 @@ void InterestRates::Initialize(BasicValues const& v)
v.database().query_into(DB_GuarInt, GenAcctGrossRate_[mce_gen_guar]);
- std::copy
- (v.yare_input_.GeneralAccountRate.begin()
- ,v.yare_input_.GeneralAccountRate.end()
- ,std::back_inserter(GenAcctGrossRate_[mce_gen_curr])
- );
- // TODO ?? At least for the antediluvian branch, the vector in
- // the input class has an inappropriate size.
- LMI_ASSERT_EQUAL(Length_, lmi::ssize(v.yare_input_.GeneralAccountRate));
- LMI_ASSERT_EQUAL(Length_, lmi::ssize(GenAcctGrossRate_[mce_gen_curr]));
- GenAcctGrossRate_[mce_gen_curr].resize(Length_);
+ GenAcctGrossRate_[mce_gen_curr] = v.yare_input_.GeneralAccountRate;
+LMI_ASSERT_EQUAL(Length_, lmi::ssize(v.yare_input_.GeneralAccountRate));
+LMI_ASSERT_EQUAL(Length_, lmi::ssize(GenAcctGrossRate_[mce_gen_curr]));
// General-account interest bonus implemented only as a simple
// additive adjustment to the annual effective rate. It probably
@@ -353,16 +346,9 @@ void InterestRates::Initialize(BasicValues const& v)
// Retrieve separate-account data from class BasicValues.
- std::copy
- (v.yare_input_.SeparateAccountRate.begin()
- ,v.yare_input_.SeparateAccountRate.end()
- ,std::back_inserter(SepAcctGrossRate_[mce_annual_rate][mce_sep_full])
- );
- // TODO ?? At least for the antediluvian branch, the vector in
- // the input class has an inappropriate size.
- LMI_ASSERT_EQUAL(Length_, lmi::ssize(v.yare_input_.SeparateAccountRate));
- LMI_ASSERT_EQUAL(Length_,
lmi::ssize(SepAcctGrossRate_[mce_annual_rate][mce_sep_full]));
- SepAcctGrossRate_[mce_annual_rate][mce_sep_full].resize(Length_);
+ SepAcctGrossRate_[mce_annual_rate][mce_sep_full] =
v.yare_input_.SeparateAccountRate;
+LMI_ASSERT_EQUAL(Length_, lmi::ssize(v.yare_input_.SeparateAccountRate));
+LMI_ASSERT_EQUAL(Length_,
lmi::ssize(SepAcctGrossRate_[mce_annual_rate][mce_sep_full]));
v.database().query_into(DB_GuarMandE , MAndERate_[mce_gen_guar]);
v.database().query_into(DB_CurrMandE , MAndERate_[mce_gen_curr]);
@@ -371,28 +357,18 @@ void InterestRates::Initialize(BasicValues const& v)
// the same way as M&E, iff database entity DB_AssetChargeType has
// the value 'oe_asset_charge_spread'; otherwise, reflect them
// elsewhere as an account-value load.
- LMI_ASSERT_EQUAL(Length_,
lmi::ssize(v.yare_input_.ExtraCompensationOnAssets));
- LMI_ASSERT_EQUAL(Length_, lmi::ssize(ExtraSepAcctCharge_));
+LMI_ASSERT_EQUAL(Length_, lmi::ssize(v.yare_input_.ExtraCompensationOnAssets));
+LMI_ASSERT_EQUAL(Length_, lmi::ssize(ExtraSepAcctCharge_));
+LMI_ASSERT(std::operator==(Zero_, ExtraSepAcctCharge_));
+// Not reliably true:
+LMI_ASSERT
+ ( ExtraSepAcctCharge_.size()
+ == v.yare_input_.ExtraCompensationOnAssets.size()
+ );
if(oe_asset_charge_spread ==
v.database().query<oenum_asset_charge_type>(DB_AssetChargeType))
{
- // TODO ?? At least for the antediluvian branch, the vector in
- // the input class has an inappropriate size. Truncating it
- // with std::transform() here is far too tricky.
+ ExtraSepAcctCharge_ = v.yare_input_.ExtraCompensationOnAssets;
LMI_ASSERT(lmi::ssize(ExtraSepAcctCharge_) == v.database().length());
-// Not reliably true:
-// LMI_ASSERT
-// ( ExtraSepAcctCharge_.size()
-// == v.yare_input_.ExtraCompensationOnAssets.size()
-// );
- // ET !! ExtraSepAcctCharge_ +=
v.yare_input_.ExtraCompensationOnAssets;
- // ...but see the problem noted above.
- std::transform
- (ExtraSepAcctCharge_.begin()
- ,ExtraSepAcctCharge_.end()
- ,v.yare_input_.ExtraCompensationOnAssets.begin()
- ,ExtraSepAcctCharge_.begin()
- ,std::plus<double>()
- );
}
if(v.yare_input_.AmortizePremiumLoad)
- [lmi-commits] [lmi] master f74f14c 06/15: Avoid non-const reference arguments, (continued)
- [lmi-commits] [lmi] master f74f14c 06/15: Avoid non-const reference arguments, Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 48caef4 07/15: Resolve a marked defect [313], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 9b46a92 08/15: Assume genacct and loan rates are always needed [312], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master a7bf1d0 04/15: Remove a duplicative defect marker [316], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master d58eb9b 12/15: Remove assertions that provably cannot fire, Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master bc8e2d9 13/15: Remove a defunct defect marker [307], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master dbac503 14/15: Demote a marked defect [306], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 791ccce 02/15: Expunge disused stable-value fund charge from database, Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 9f4e2a2 09/15: Expunge an unused member function [311], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 387eeaa 10/15: Prepare to resolve some marked defects, Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master cb5e424 11/15: Resolve several marked defects [308],
Greg Chicares <=
- [lmi-commits] [lmi] master 4912e96 03/15: Simplify [317], Greg Chicares, 2021/02/14
- [lmi-commits] [lmi] master 3143a30 15/15: Simplify using expression templates [305], Greg Chicares, 2021/02/14