[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [4802] Add a unit test to measure speed of reading product
From: |
Greg Chicares |
Subject: |
[lmi-commits] [4802] Add a unit test to measure speed of reading product files |
Date: |
Mon, 22 Mar 2010 13:26:38 +0000 |
Revision: 4802
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4802
Author: chicares
Date: 2010-03-22 13:26:38 +0000 (Mon, 22 Mar 2010)
Log Message:
-----------
Add a unit test to measure speed of reading product files
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/Makefile.am
lmi/trunk/ihs_dbdict.hpp
lmi/trunk/objects.make
Added Paths:
-----------
lmi/trunk/product_file_test.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-03-22 13:17:19 UTC (rev 4801)
+++ lmi/trunk/ChangeLog 2010-03-22 13:26:38 UTC (rev 4802)
@@ -24562,3 +24562,17 @@
semantic difference between the two [14.1/2]. This convention had
already been followed in almost every case.
+20100322T1317Z <address@hidden> [761]
+
+ progress_meter_test.cpp
+Refactor to eliminate redundant qualified-id.
+
+20100322T1326Z <address@hidden> [761]
+
+ Makefile.am
+ ihs_dbdict.hpp
+ objects.make
+ product_file_test.cpp [new file]
+Add a unit test to measure speed of reading product files, emulating
+'progress_meter_test.cpp'.
+
Modified: lmi/trunk/Makefile.am
===================================================================
--- lmi/trunk/Makefile.am 2010-03-22 13:17:19 UTC (rev 4801)
+++ lmi/trunk/Makefile.am 2010-03-22 13:26:38 UTC (rev 4802)
@@ -119,6 +119,7 @@
test_obstruct_slicing \
test_path_utility \
test_print_matrix \
+ test_product_file \
test_progress_meter \
test_quiet_nan \
test_round \
@@ -720,6 +721,30 @@
print_matrix_test.cpp
test_print_matrix_CXXFLAGS = $(AM_CXXFLAGS)
+# 'expm1.cpp' is for como on msw
+test_product_file_SOURCES = \
+ $(common_test_objects) \
+ data_directory.cpp \
+ dbnames.cpp \
+ expm1.cpp \
+ global_settings.cpp \
+ ihs_dbdict.cpp \
+ ihs_dbvalue.cpp \
+ ihs_fpios.cpp \
+ ihs_funddata.cpp \
+ ihs_pios.cpp \
+ ihs_proddata.cpp \
+ ihs_rnddata.cpp \
+ miscellany.cpp \
+ path_utility.cpp \
+ product_file_test.cpp \
+ rounding_rules.cpp \
+ stratified_charges.cpp \
+ timer.cpp
+test_product_file_CXXFLAGS = $(AM_CXXFLAGS)
+test_progress_meter_LDADD = \
+ $(BOOST_LIBS)
+
test_progress_meter_SOURCES = \
$(common_test_objects) \
null_stream.cpp \
Modified: lmi/trunk/ihs_dbdict.hpp
===================================================================
--- lmi/trunk/ihs_dbdict.hpp 2010-03-22 13:17:19 UTC (rev 4801)
+++ lmi/trunk/ihs_dbdict.hpp 2010-03-22 13:26:38 UTC (rev 4802)
@@ -47,6 +47,7 @@
,virtual private obstruct_slicing<DBDictionary>
{
friend class DatabaseDocument;
+ friend class product_file_test;
public:
static DBDictionary& instance();
Modified: lmi/trunk/objects.make
===================================================================
--- lmi/trunk/objects.make 2010-03-22 13:17:19 UTC (rev 4801)
+++ lmi/trunk/objects.make 2010-03-22 13:26:38 UTC (rev 4802)
@@ -483,6 +483,7 @@
obstruct_slicing_test \
path_utility_test \
print_matrix_test \
+ product_file_test \
progress_meter_test \
quiet_nan_test \
regex_test \
@@ -768,6 +769,27 @@
facets.o \
print_matrix_test.o \
+product_file_test$(EXEEXT): \
+ $(boost_filesystem_objects) \
+ $(common_test_objects) \
+ data_directory.o \
+ dbnames.o \
+ expm1.o \
+ global_settings.o \
+ ihs_dbdict.o \
+ ihs_dbvalue.o \
+ ihs_fpios.o \
+ ihs_funddata.o \
+ ihs_pios.o \
+ ihs_proddata.o \
+ ihs_rnddata.o \
+ miscellany.o \
+ path_utility.o \
+ product_file_test.o \
+ rounding_rules.o \
+ stratified_charges.o \
+ timer.o \
+
progress_meter_test$(EXEEXT): \
$(common_test_objects) \
null_stream.o \
Added: lmi/trunk/product_file_test.cpp
===================================================================
--- lmi/trunk/product_file_test.cpp (rev 0)
+++ lmi/trunk/product_file_test.cpp 2010-03-22 13:26:38 UTC (rev 4802)
@@ -0,0 +1,131 @@
+// Product files--unit test.
+//
+// Copyright (C) 2010 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// http://savannah.nongnu.org/projects/lmi
+// email: <address@hidden>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+// $Id$
+
+#ifdef __BORLANDC__
+# include "pchfile.hpp"
+# pragma hdrstop
+#endif // __BORLANDC__
+
+#include "ihs_dbdict.hpp"
+#include "ihs_funddata.hpp"
+#include "ihs_proddata.hpp"
+#include "ihs_rnddata.hpp"
+#include "stratified_charges.hpp"
+
+#include "test_tools.hpp"
+#include "timer.hpp"
+
+#include <string>
+
+class product_file_test
+{
+ public:
+ static void test()
+ {
+ write_all_files();
+ assay_speed();
+ }
+
+ private:
+ static void write_all_files();
+ static void assay_speed();
+ static void read_database_file() ;
+ static void read_fund_file() ;
+ static void read_policy_file() ;
+ static void read_rounding_file() ;
+ static void read_stratified_file() ;
+
+ static std::string database_filename_ ;
+ static std::string fund_filename_ ;
+ static std::string policy_filename_ ;
+ static std::string rounding_filename_ ;
+ static std::string stratified_filename_ ;
+};
+
+std::string product_file_test::database_filename_ ;
+std::string product_file_test::fund_filename_ ;
+std::string product_file_test::policy_filename_ ;
+std::string product_file_test::rounding_filename_ ;
+std::string product_file_test::stratified_filename_ ;
+
+void product_file_test::write_all_files()
+{
+ DBDictionary::instance() .WriteSampleDBFile ();
+ TProductData ::WritePolFiles ();
+ FundData ::WriteFundFiles ();
+ StreamableRoundingRules ::WriteRndFiles ();
+ stratified_charges ::write_stratified_files ();
+
+ policy_filename_ = "sample";
+ TProductData p(policy_filename_);
+ database_filename_ = p.GetDatabaseFilename ();
+ fund_filename_ = p.GetFundFilename ();
+ rounding_filename_ = p.GetRoundingFilename ();
+ stratified_filename_ = p.GetTierFilename ();
+}
+
+void product_file_test::read_database_file()
+{
+ DBDictionary::instance().InvalidateCache();
+ DBDictionary::instance().Init(database_filename_);
+}
+
+void product_file_test::read_fund_file()
+{
+ FundData f(fund_filename_);
+}
+
+void product_file_test::read_policy_file()
+{
+ TProductData p(policy_filename_);
+}
+
+void product_file_test::read_rounding_file()
+{
+ StreamableRoundingRules r(rounding_filename_);
+}
+
+void product_file_test::read_stratified_file()
+{
+ stratified_charges s(stratified_filename_);
+}
+
+void product_file_test::assay_speed()
+{
+ std::cout
+ << " Speed tests..."
+ << "\n Read 'database' : " << TimeAnAliquot(read_database_file )
+ << "\n Read 'fund' : " << TimeAnAliquot(read_fund_file )
+ << "\n Read 'policy' : " << TimeAnAliquot(read_policy_file )
+ << "\n Read 'rounding' : " << TimeAnAliquot(read_rounding_file )
+ << "\n Read 'stratified' : " << TimeAnAliquot(read_stratified_file)
+ << '\n'
+ ;
+}
+
+int test_main(int, char*[])
+{
+ product_file_test::test();
+ return EXIT_SUCCESS;
+}
+
Property changes on: lmi/trunk/product_file_test.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [4802] Add a unit test to measure speed of reading product files,
Greg Chicares <=