lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9b2b7b4 2/7: Withdraw an unnecessary friendsh


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9b2b7b4 2/7: Withdraw an unnecessary friendship
Date: Mon, 4 Mar 2019 12:06:41 -0500 (EST)

branch: master
commit 9b2b7b42e86cf20ff7db702b0c245850b2c31d72
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Withdraw an unnecessary friendship
    
    Now that all DBDictionary ctors call InitDB(), these lines in
    'product_file_test.cpp':
    -    DBDictionary().Init(database_filename_);
    +    DBDictionary d(database_filename_);
    do the same thing and take about the same amount of time, so the
    second is preferable because it's simpler and requires no friendship.
---
 dbdict.hpp            | 1 -
 product_file_test.cpp | 7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dbdict.hpp b/dbdict.hpp
index 06e84bb..db93e59 100644
--- a/dbdict.hpp
+++ b/dbdict.hpp
@@ -41,7 +41,6 @@ class LMI_SO DBDictionary
 {
     friend class DatabaseDocument;
     friend class input_test;        // For test_product_database().
-    friend class product_file_test; // For read_database_file().
     friend class premium_tax_test;  // For test_rates().
 
   public:
diff --git a/product_file_test.cpp b/product_file_test.cpp
index cee08e3..063667d 100644
--- a/product_file_test.cpp
+++ b/product_file_test.cpp
@@ -130,9 +130,14 @@ void product_file_test::test_copying()
     BOOST_TEST(      99 == g.query<int>(DB_MaxIncrAge));
 }
 
+// This implementation:
+//   auto d = DBDictionary::read_via_cache(database_filename_);
+// would cause assay_speed() to report a much faster run time,
+// yet such a timing would have little significance.
+
 void product_file_test::read_database_file()
 {
-    DBDictionary().Init(database_filename_);
+    DBDictionary d(database_filename_);
 }
 
 void product_file_test::read_fund_file()



reply via email to

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