lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5095] Remove the problem identified 20100806T1314Z


From: Greg Chicares
Subject: [lmi-commits] [5095] Remove the problem identified 20100806T1314Z
Date: Fri, 06 Aug 2010 14:02:43 +0000

Revision: 5095
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5095
Author:   chicares
Date:     2010-08-06 14:02:43 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
Remove the problem identified 20100806T1314Z

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/dbindex.hpp
    lmi/trunk/input_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-08-06 13:14:31 UTC (rev 5094)
+++ lmi/trunk/ChangeLog 2010-08-06 14:02:43 UTC (rev 5095)
@@ -26719,3 +26719,30 @@
 Fix defect introduced 20100704T1645Z. See:
   http://lists.nongnu.org/archive/html/lmi/2010-08/msg00000.html
 
+20100806T0943Z <address@hidden> [656]
+
+  ihs_basicval.cpp
+Improve layout; expunge obsolete documentation.
+
+20100806T0945Z <address@hidden> [656]
+
+  input_test.cpp
+Demonstrate a latent problem.
+
+20100806T1312Z <address@hidden> [656]
+
+  database.cpp
+  database.hpp
+Remove the problem identified 20100806T0945Z.
+
+20100806T1314Z <address@hidden> [656]
+
+  input_test.cpp
+Demonstrate a latent problem.
+
+20100806T1402Z <address@hidden> [656]
+
+  dbindex.hpp
+  input_test.cpp
+Remove the problem identified 20100806T1314Z.
+

Modified: lmi/trunk/dbindex.hpp
===================================================================
--- lmi/trunk/dbindex.hpp       2010-08-06 13:14:31 UTC (rev 5094)
+++ lmi/trunk/dbindex.hpp       2010-08-06 14:02:43 UTC (rev 5095)
@@ -26,6 +26,7 @@
 
 #include "config.hpp"
 
+#include "assert_lmi.hpp"
 #include "mc_enum_type_enums.hpp"
 
 #include <vector>
@@ -95,13 +96,16 @@
     database_index& gender   (mcenum_gender   z) {idx_[0] = z; return *this;}
     database_index& uw_class (mcenum_class    z) {idx_[1] = z; return *this;}
     database_index& smoking  (mcenum_smoking  z) {idx_[2] = z; return *this;}
-    database_index& issue_age(int             z) {idx_[3] = z; return *this;}
+    database_index& issue_age(int             z) {check_issue_age(z);
+                                                  idx_[3] = z; return *this;}
     database_index& uw_basis (mcenum_uw_basis z) {idx_[4] = z; return *this;}
     database_index& state    (mcenum_state    z) {idx_[5] = z; return *this;}
 
     std::vector<int> const& index_vector() const {return idx_;}
 
   private:
+    void check_issue_age(int z) {LMI_ASSERT(0 <= z && z < 
e_max_dim_issue_age);}
+
     std::vector<int> idx_;
 };
 

Modified: lmi/trunk/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp    2010-08-06 13:14:31 UTC (rev 5094)
+++ lmi/trunk/input_test.cpp    2010-08-06 14:02:43 UTC (rev 5095)
@@ -191,13 +191,39 @@
     BOOST_TEST_EQUAL(55, db.length());
     BOOST_TEST_EQUAL(71, v.size());
 
-    // Test presumptive bounds on issue-age index.
-std::cout << v.size() << "...should be rejected, but isn't.\n";
-    index.issue_age(-1);
+    // Test presumptive issue-age bounds in class database_index.
+    BOOST_TEST_THROW
+        (index.issue_age(100)
+        ,std::runtime_error
+        ,"Assertion '0 <= z && z < e_max_dim_issue_age' failed."
+        );
+    BOOST_TEST_THROW
+        (index.issue_age(-1)
+        ,std::runtime_error
+        ,"Assertion '0 <= z && z < e_max_dim_issue_age' failed."
+        );
+
+    index.issue_age(99);
     db.Query(v, DB_SnflQ, index);
-std::cout << v.size() << "...should be rejected, and is.\n";
-    index.issue_age(100);
+    BOOST_TEST_EQUAL( 1, v.size());
+
+    // Force the product to mature at 98.
+    db.maturity_age_ = 98;
+    index.issue_age(98);
+    db.Query(DB_MaturityAge, index); // Accepted because maturity age is 
scalar.
+    BOOST_TEST_THROW
+        (db.Query(v, DB_SnflQ, index)
+        ,std::runtime_error
+        ,"Assertion '0 < local_length && local_length <= methuselah' failed."
+        );
+
+    index.issue_age(97);
     db.Query(v, DB_SnflQ, index);
+    BOOST_TEST_EQUAL( 1, v.size());
+
+    index.issue_age(0);
+    db.Query(v, DB_SnflQ, index);
+    BOOST_TEST_EQUAL(98, v.size());
 }
 
 void input_test::test_input_class()




reply via email to

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