lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4917] Expand unit test


From: Greg Chicares
Subject: [lmi-commits] [4917] Expand unit test
Date: Fri, 07 May 2010 18:45:54 +0000

Revision: 4917
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4917
Author:   chicares
Date:     2010-05-07 18:45:53 +0000 (Fri, 07 May 2010)
Log Message:
-----------
Expand unit test

Modified Paths:
--------------
    lmi/trunk/input_test.cpp

Modified: lmi/trunk/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp    2010-05-06 21:11:49 UTC (rev 4916)
+++ lmi/trunk/input_test.cpp    2010-05-07 18:45:53 UTC (rev 4917)
@@ -96,7 +96,46 @@
     yare_input yi(input);
     product_database db(yi);
     std::vector<double> v;
+    std::vector<double> w;
 
+    // This vector's last element must be replicated.
+    int dims_stat[database_entity::e_number_of_axes] = {1, 1, 1, 1, 1, 1, 10};
+    double stat[10] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.05};
+    DBDictionary::instance().dictionary_[DB_StatVxQ] = database_entity
+        (DB_StatVxQ
+        ,database_entity::e_number_of_axes
+        ,dims_stat
+        ,stat
+        );
+    db.Query(v, DB_StatVxQ);
+    w.assign(stat, stat + 10);
+    w.insert(w.end(), db.length() - w.size(), w.back());
+    BOOST_TEST(v == w);
+
+    // This vector must be truncated.
+    int dims_tax[database_entity::e_number_of_axes] = {1, 1, 1, 1, 1, 1, 100};
+    double tax[100] =
+        {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
+        ,0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
+        ,0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2
+        ,0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3
+        ,0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4
+        ,0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5
+        ,0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6
+        ,0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7
+        ,0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8
+        ,0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9
+        };
+    DBDictionary::instance().dictionary_[DB_TaxVxQ] = database_entity
+        (DB_TaxVxQ
+        ,database_entity::e_number_of_axes
+        ,dims_tax
+        ,tax
+        );
+    db.Query(v, DB_TaxVxQ);
+    w.assign(tax, tax + db.length());
+    BOOST_TEST(v == w);
+
     std::cout
         << "\n  Database speed tests..."
         << "\n  initialize()      : " << 
TimeAnAliquot(boost::bind(&product_database::initialize,       &db))





reply via email to

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