[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master fe56ee8 4/5: Adapt 'premium_tax_test' to rece
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master fe56ee8 4/5: Adapt 'premium_tax_test' to recent database caching changes |
Date: |
Wed, 3 Aug 2016 14:39:15 +0000 (UTC) |
branch: master
commit fe56ee89d923767307228921f9b3a11c5f6769e1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Adapt 'premium_tax_test' to recent database caching changes
---
database.hpp | 3 ++-
premium_tax_test.cpp | 14 ++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/database.hpp b/database.hpp
index d354c00..24abd64 100644
--- a/database.hpp
+++ b/database.hpp
@@ -46,7 +46,8 @@ class LMI_SO product_database
: private lmi::uncopyable <product_database>
,virtual private obstruct_slicing<product_database>
{
- friend class input_test; // For test_product_database().
+ friend class input_test; // For test_product_database().
+ friend class premium_tax_test; // For test_rates().
public:
product_database
diff --git a/premium_tax_test.cpp b/premium_tax_test.cpp
index 5329bb2..1a42207 100644
--- a/premium_tax_test.cpp
+++ b/premium_tax_test.cpp
@@ -46,11 +46,11 @@ class premium_tax_test
void premium_tax_test::write_prerequisite_files()
{
- DBDictionary::instance() .WriteSampleDBFile ();
+ DBDictionary() .WriteSampleDBFile ();
// product_database::initialize() requires a real '.product' file,
// even though it's not otherwise used in this TU.
- product_data ::WritePolFiles ();
- stratified_charges ::write_stratified_files ();
+ product_data ::WritePolFiles ();
+ stratified_charges ::write_stratified_files ();
}
/// Test premium-tax rates.
@@ -106,10 +106,12 @@ void premium_tax_test::test_rates()
// A uniform but nonzero load would elicit a runtime error,
// because the tiered load is not zero.
{
- database_entity const original =
DBDictionary::instance().datum("PremTaxLoad");
+ DBDictionary& dictionary = const_cast<DBDictionary&>(*db.db_);
+
+ database_entity const original = dictionary.datum("PremTaxLoad");
database_entity const scalar(DB_PremTaxLoad, 0.0000);
- DBDictionary::instance().datum("PremTaxLoad") = scalar;
+ dictionary.datum("PremTaxLoad") = scalar;
premium_tax z(mce_s_AK, mce_s_CT, false, db, strata);
BOOST_TEST_EQUAL(z.levy_rate (), 0.0000);
@@ -119,7 +121,7 @@ void premium_tax_test::test_rates()
BOOST_TEST_EQUAL(z.is_tiered (), true );
BOOST_TEST_EQUAL(z.calculate_load(1.0, strata), 0.0000);
- DBDictionary::instance().datum("PremTaxLoad") = original;
+ dictionary.datum("PremTaxLoad") = original;
}
// Amortized.