[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [4913] Further test product_database::GetEntry()
From: |
Greg Chicares |
Subject: |
[lmi-commits] [4913] Further test product_database::GetEntry() |
Date: |
Thu, 06 May 2010 14:38:39 +0000 |
Revision: 4913
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4913
Author: chicares
Date: 2010-05-06 14:38:39 +0000 (Thu, 06 May 2010)
Log Message:
-----------
Further test product_database::GetEntry()
Modified Paths:
--------------
lmi/trunk/dbdict.hpp
lmi/trunk/input_test.cpp
Modified: lmi/trunk/dbdict.hpp
===================================================================
--- lmi/trunk/dbdict.hpp 2010-05-06 13:51:14 UTC (rev 4912)
+++ lmi/trunk/dbdict.hpp 2010-05-06 14:38:39 UTC (rev 4913)
@@ -44,6 +44,7 @@
,virtual private obstruct_slicing<DBDictionary>
{
friend class DatabaseDocument;
+ friend class input_test;
friend class product_file_test;
public:
Modified: lmi/trunk/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp 2010-05-06 13:51:14 UTC (rev 4912)
+++ lmi/trunk/input_test.cpp 2010-05-06 14:38:39 UTC (rev 4913)
@@ -37,6 +37,7 @@
// End of headers tested here.
#include "assert_lmi.hpp"
+#include "dbdict.hpp"
#include "dbnames.hpp"
#include "miscellany.hpp"
#include "test_tools.hpp"
@@ -96,12 +97,6 @@
product_database db(yi);
std::vector<double> v;
- BOOST_TEST_THROW
- (db.GetEntry(-1)
- ,std::runtime_error
- ,"Assertion 'DB_FIRST <= k && k < DB_LAST' failed."
- );
-
std::cout
<< "\n Database speed tests..."
<< "\n initialize() : " <<
TimeAnAliquot(boost::bind(&product_database::initialize, &db))
@@ -111,6 +106,24 @@
<< "\n GetEntry() : " <<
TimeAnAliquot(boost::bind(&product_database::GetEntry, &db, DB_EndtAge))
<< '\n'
;
+
+ BOOST_TEST_THROW
+ (db.GetEntry(-1)
+ ,std::runtime_error
+ ,"Assertion 'DB_FIRST <= k && k < DB_LAST' failed."
+ );
+
+ // It is so difficult to contrive a testcase that produces this
+ // diagnostic that the diagnostic seems to have little value:
+ // a simple assertion would probably be better.
+ database_entity const e = db.GetEntry(DB_EndtAge);
+ DBDictionary::instance().dictionary_[1 + DB_LAST] = e;
+ DBDictionary::instance().dictionary_.erase(DB_EndtAge);
+ BOOST_TEST_THROW
+ (db.GetEntry(DB_EndtAge)
+ ,std::runtime_error
+ ,"Database entity 'EndtAge' not found."
+ );
}
void input_test::test_input_class()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [4913] Further test product_database::GetEntry(),
Greg Chicares <=