lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master e90d331 1/2: Test input sequence construction


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e90d331 1/2: Test input sequence construction from short vectors
Date: Sat, 28 Jan 2017 21:13:33 +0000 (UTC)

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

    Test input sequence construction from short vectors
---
 input_seq_test.cpp |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/input_seq_test.cpp b/input_seq_test.cpp
index d7563af..073b84e 100644
--- a/input_seq_test.cpp
+++ b/input_seq_test.cpp
@@ -291,13 +291,32 @@ int test_main(int, char*[])
 //   additive expressions e.g. retirement-10 ?
 
     // Test construction from vector.
-    //   1 1 1 2 2 --> 1 [0,3);2 [3,5)
     // TODO ?? Test against canonical representation once we define that.
     {
     int const n = 5;
     double const d[n] = {1, 1, 1, 2, 2};
     std::vector<double> const v(d, d + n);
     BOOST_TEST(v == InputSequence(v).linear_number_representation());
+    BOOST_TEST_EQUAL
+        ("1 [0, 3); 2 [3, maturity)"
+        ,InputSequence(v).mathematical_representation()
+        );
+    }
+
+    // Test construction from one-element vector.
+    {
+    int const n = 1;
+    double const d[n] = {3};
+    std::vector<double> const v(d, d + n);
+    BOOST_TEST(v == InputSequence(v).linear_number_representation());
+    BOOST_TEST_EQUAL("3", InputSequence(v).mathematical_representation());
+    }
+
+    // Test construction from empty vector.
+    {
+    std::vector<double> const v;
+    BOOST_TEST(v == InputSequence(v).linear_number_representation());
+    BOOST_TEST_EQUAL("0", InputSequence(v).mathematical_representation());
     }
 
     // Test (enumerative) extra keywords.



reply via email to

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