lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 1c737b9 1/3: Demonstrate that canonical_form(


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 1c737b9 1/3: Demonstrate that canonical_form() is identical to GUI c14n
Date: Sat, 25 Feb 2017 14:48:16 -0500 (EST)

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

    Demonstrate that canonical_form() is identical to GUI c14n
    
    Added tests that show that these two functions
      InputSequenceEditor::sequence_string()
            InputSequence::canonical_form()
    canonicalize every input sequence in the unit test identically.
---
 input_sequence_test.cpp | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/input_sequence_test.cpp b/input_sequence_test.cpp
index 36ad55e..b4db1fb 100644
--- a/input_sequence_test.cpp
+++ b/input_sequence_test.cpp
@@ -148,8 +148,8 @@ int test_main(int, char*[])
     double const d[n] = {0, 0, 0, 0, 0};
     std::string const e("");
     census += e + "\t\tcorp pmt empty\t\n";
-    // '0'
     std::string const g("0");
+BOOST_TEST(std::string("0") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -159,8 +159,8 @@ int test_main(int, char*[])
     double const d[n] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
     std::string const e(" ");
     census += e + "\t\tcorp pmt blank\t\n";
-    // '0'
     std::string const g("0");
+BOOST_TEST(std::string("0") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -171,8 +171,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 7, 7, 0, 0, 0, 0};
     std::string const e("1 3; 7 5;0");
     census += e + "\t\t\t\n";
-    // '1 3; 7 5; 0'
     std::string const g("1 3; 7 5; 0");
+BOOST_TEST(std::string("1 3; 7 5; 0") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -183,8 +183,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 2, 3, 3, 3};
     std::string const e("1; 2; 3");
     census += e + "\t\t\t\n";
-    // '1 1; 2 2; 3'
     std::string const g("1 1; 2 2; 3");
+BOOST_TEST(std::string("1 1; 2 2; 3") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -194,8 +194,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string const e("1 3; 3 6; 5 9; 7");
     census += e + "\t\t\t\n";
-    // '1 3; 3 6; 5 9; 7'
     std::string const g("1 3; 3 6; 5 9; 7");
+BOOST_TEST(std::string("1 3; 3 6; 5 9; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -205,8 +205,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string const e("1 @93; 3 @96; 5 @99; 7");
     census += e + "\t\t\t\n";
-    // '1 @93; 3 @96; 5 @99; 7'
     std::string const g("1 @93; 3 @96; 5 @99; 7");
+BOOST_TEST(std::string("1 @93; 3 @96; 5 @99; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -216,8 +216,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string const e("1 #3; 3 #3; 5 #3; 7");
     census += e + "\t\t\t\n";
-    // '1 #3; 3 #3; 5 #3; 7'
     std::string const g("1 #3; 3 #3; 5 #3; 7");
+BOOST_TEST(std::string("1 #3; 3 #3; 5 #3; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -229,8 +229,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 3, 3, 3, 5, 7, 7, 7};
     std::string const e("1 [0, 2); 3 [2, 5); 5 [5, 6); 7");
     census += e + "\t\t\t\n";
-    // '1 2; 3 5; 5 6; 7'
     std::string const g("1 2; 3 5; 5 6; 7");
+BOOST_TEST(std::string("1 2; 3 5; 5 6; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -240,9 +240,9 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 7, 7};
     std::string const e("1; 1 (0, 2]; 3 (2, 5]; 5 (5, 6]; 7");
     census += e + "\t\t\t\n";
-    // '1 1; 1 3; 3 6; 5 7; 7'
     // Should the first two intervals be combined?
     std::string const g("1 1; 1 3; 3 6; 5 7; 7");
+BOOST_TEST(std::string("1 1; 1 3; 3 6; 5 7; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -252,8 +252,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 1, 1, 1, 2, 3, 4, 5, 5};
     std::string const e("1 [0, 4); 2 5; 3 #1; 4 @97; 5");
     census += e + "\t\t\t\n";
-    // '1 4; 2 5; 3 #1; 4 @97; 5'
     std::string const g("1 4; 2 5; 3 #1; 4 @97; 5");
+BOOST_TEST(std::string("1 4; 2 5; 3 #1; 4 @97; 5") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -263,8 +263,8 @@ int test_main(int, char*[])
     double const d[n] = {1, 3, 5, 7, 7};
     std::string const e("1 [0, 1); 3 [1, 2); 5 (1, 2]; 7");
     census += e + "\t\t\t\n";
-    // '1 1; 3 2; 5 3; 7'
     std::string const g("1 1; 3 2; 5 3; 7");
+BOOST_TEST(std::string("1 1; 3 2; 5 3; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -323,8 +323,8 @@ int test_main(int, char*[])
     double const d[n] = {0, 1, 0, 3, 0, 5, 7, 7, 7};
     std::string const e("1 [1, 2); 3 [3, 3]; 5 (4, 5]; 7");
     census += e + "\t\t\t\n";
-    // '0 1; 1 2; 0 3; 3 4; 0 5; 5 6; 7'
     std::string const g("0 1; 1 2; 0 3; 3 4; 0 5; 5 6; 7");
+BOOST_TEST(std::string("0 1; 1 2; 0 3; 3 4; 0 5; 5 6; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -365,8 +365,8 @@ int test_main(int, char*[])
     double const d[n] = {0, 12, 0, 27, 0, 1, 7, 7, 7, 7};
     std::string const e("12 [1, @92); 27 address@hidden, @93]; 1 (@94, #1]; 
7");
     census += e + "\t\t\t\n";
-    // '0 1; 12 @92; 0 @93; 27 @94; 0 @95; 1 #1; 7'
     std::string const g("0 1; 12 @92; 0 @93; 27 @94; 0 @95; 1 #1; 7");
+BOOST_TEST(std::string("0 1; 12 @92; 0 @93; 27 @94; 0 @95; 1 #1; 7") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -378,8 +378,8 @@ int test_main(int, char*[])
     double const d[n] = {0, 12.25, 0, 27.875, 0, 1.0625, 7.5, 7.5, 7.5, 7.5};
     std::string const e("12.25 [1,@92); 27.875 address@hidden,@93]; 
1.0625(@94,#1]; 7.5");
     census += e + "\t\t\t\n";
-    // '0 1; 12.25 @92; 0 @93; 27.875 @94; 0 @95; 1.0625 #1; 7.5'
     std::string const g("0 1; 12.25 @92; 0 @93; 27.875 @94; 0 @95; 1.0625 #1; 
7.5");
+BOOST_TEST(std::string("0 1; 12.25 @92; 0 @93; 27.875 @94; 0 @95; 1.0625 #1; 
7.5") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     }
 
@@ -425,13 +425,13 @@ int test_main(int, char*[])
     double const d[n] = { 0 ,  0 ,   0  ,   0  ,  0 ,  0 ,  0 ,  0 ,  0 };
     std::string const e("p[0, 2); rrr [2, 4);q[4, 6);");
     census += "glp[0, 2); target [2, 4);gsp[4, 6);\t\t\t\n";
-    // 'glp 2; target 4; gsp'
     std::string const g("p 2; rrr 4; q");
+BOOST_TEST(std::string("p 2; rrr 4; q") == g);
     strvec const k{"not_used", "p", "q", "r", "rr", "rrr"};
     check(__FILE__, __LINE__, n, d, e, g, "", k, c);
     // Toggle keywords-only switch on: same result.
     census += "\tannual[0, 2); quarterly [2, 4);monthly[4, 6);\t\t\n";
-    // 'annual 2; quarterly 4; monthly'
+BOOST_TEST(std::string("p 2; rrr 4; q") == g);
     bool const o = true;
     check(__FILE__, __LINE__, n, d, e, g, "", k, c, o);
     // Toggle keywords-only switch explicitly off: same result.
@@ -445,8 +445,8 @@ int test_main(int, char*[])
     double const d[n] ={ 1,  1,       0     ,       0     ,  5,  5,  7,  7,  
7};
     std::string const e("1 [0, 2); keyword_00 [2, 4); 5 [4, 6); 7");
     census += "1 [0, 2); corridor [2, 4); 5 [4, 6); 7\t\t\t\n";
-    // '1 2; corridor 4; 5 6; 7'
     std::string const g("1 2; keyword_00 4; 5 6; 7");
+BOOST_TEST(std::string("1 2; keyword_00 4; 5 6; 7") == g);
     strvec const k{"keyword_00"};
     check(__FILE__, __LINE__, n, d, e, g, "", k, c);
     }
@@ -508,8 +508,8 @@ int test_main(int, char*[])
     double const d[n] = { 0 ,  0 ,  0 ,  0 ,  0 };
     std::string const e("q [0, 2); p [4, maturity)");
     census += "\tquarterly [0, 2); monthly [4, maturity)\t\t\n";
-    // 'quarterly 2; annual 4; monthly'
     std::string const g("q 2; z 4; p");
+BOOST_TEST(std::string("q 2; z 4; p") == g);
     strvec const k{"p", "q", "z"};
     bool const o = true;
     std::string w("z");
@@ -551,8 +551,8 @@ int test_main(int, char*[])
     double const d[n] = { 0 ,  0 ,  0 ,  0 ,  0 };
     std::string const e("q [1, 3); p [3, maturity)");
     census += "\tquarterly [1, 3); monthly [3, maturity)\t\t\n";
-    // 'annual 1; quarterly 3; monthly'
     std::string const g("z 1; q 3; p");
+BOOST_TEST(std::string("z 1; q 3; p") == g);
     strvec const k{"p", "q", "z"};
     bool const o = true;
     std::string w("z");
@@ -570,8 +570,8 @@ int test_main(int, char*[])
     double const d[n] = { 0 ,  0 ,  0 ,  0 ,  0 };
     std::string const e("q [1, 3); p [3, maturity)");
     census += "sevenpay [1, 3); glp [3, maturity)\t\t\t\n";
-    // '0 1; sevenpay 3; glp'
     std::string const g("0 1; q 3; p");
+BOOST_TEST(std::string("0 1; q 3; p") == g);
     strvec const k{"p", "q", "z"};
     check(__FILE__, __LINE__, n, d, e, g, "", k, c);
     }
@@ -582,8 +582,8 @@ int test_main(int, char*[])
     double const d[n] = {7, 7, 7, 7, 7, 4, 4, 4, 4, 4};
     std::string const e("7, retirement; 4, maturity");
     census += e + "\t\t\t\n";
-    // '7 retirement; 4'
     std::string const g("7 retirement; 4");
+BOOST_TEST(std::string("7 retirement; 4") == g);
     check(__FILE__, __LINE__, n, d, e, g);
     InputSequence const seq(e, 10, 90, 95, 0, 2002);
     std::vector<ValueInterval> const& i(seq.interval_representation());



reply via email to

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