lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master adfc235 1/2: Reorder arguments


From: Greg Chicares
Subject: [lmi-commits] [lmi] master adfc235 1/2: Reorder arguments
Date: Thu, 26 Jan 2017 13:21:50 +0000 (UTC)

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

    Reorder arguments
    
    In preparation for combining check[012](), write common arguments
    first, so that optional arguments and their defaults can be added
    at the end.
---
 input_seq_test.cpp |   64 ++++++++++++++++++++++++++--------------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/input_seq_test.cpp b/input_seq_test.cpp
index 5be7aa6..8446213 100644
--- a/input_seq_test.cpp
+++ b/input_seq_test.cpp
@@ -80,11 +80,11 @@ void check
 
 template<typename T>
 void check0
-    (T const* d
+    (char const* file
+    ,int line
+    ,T const* d
     ,int n
     ,std::string const& e
-    ,char const* file
-    ,int line
     )
 {
     InputSequence seq(e, n, 90, 95, 0, 2002, 0);
@@ -96,13 +96,13 @@ void check0
 
 template<typename T>
 void check1
-    (T const* d
+    (char const* file
+    ,int line
+    ,T const* d
     ,int n
     ,std::string const& e
     ,std::vector<std::string> const& k
     ,char const* const* c
-    ,char const* file
-    ,int line
     )
 {
     InputSequence seq(e, n, 90, 95, 0, 2002, 0, k);
@@ -118,14 +118,14 @@ void check1
 
 template<typename T>
 void check2
-    (T const* d
+    (char const* file
+    ,int line
+    ,T const* d
     ,int n
     ,std::string const& e
     ,std::vector<std::string> const& k
     ,char const* const* c
     ,std::string const& w
-    ,char const* file
-    ,int line
     )
 {
     InputSequence seq(e, n, 90, 95, 0, 2002, 0, k, w);
@@ -156,7 +156,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
     std::string e(" ");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Make sure example in comment at top works.
@@ -165,7 +165,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {1, 1, 1, 7, 7, 0, 0, 0, 0};
     std::string e("1 3; 7 5;0");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Numbers separated by semicolons mean values; the last is
@@ -174,7 +174,7 @@ int test_main(int, char*[])
     int const n = 5;
     double const d[n] = {1, 2, 3, 3, 3};
     std::string e("1; 2; 3");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Number-pairs separated by semicolons mean {value, end-duration}.
@@ -182,7 +182,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string e("1 3; 3 6; 5 9; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // {value, @ attained_age}
@@ -190,7 +190,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string e("1 @93; 3 @96; 5 @99; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // {value, # number_of_years_since_last_interval_endpoint}
@@ -198,7 +198,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string e("1 #3; 3 #3; 5 #3; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // {value [|( begin-duration, end-duration ]|) }
@@ -208,7 +208,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {1, 1, 3, 3, 3, 5, 7, 7, 7};
     std::string e("1 [0, 2); 3 [2, 5); 5 [5, 6); 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test (x,y].
@@ -216,7 +216,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 7, 7};
     std::string e("1; 1 (0, 2]; 3 (2, 5]; 5 (5, 6]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test a mixture of all five ways of specifying duration.
@@ -224,7 +224,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {1, 1, 1, 1, 2, 3, 4, 5, 5};
     std::string e("1 [0, 4); 2 5; 3 #1; 4 @97; 5");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test intervals of length one.
@@ -232,7 +232,7 @@ int test_main(int, char*[])
     int const n = 5;
     double const d[n] = {1, 3, 5, 7, 7};
     std::string e("1 [0, 1); 3 [1, 2); 5 (1, 2]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test empty intervals.
@@ -240,7 +240,7 @@ int test_main(int, char*[])
     int const n = 5;
     double const d[n] = {1, 3, 5, 7, 7};
     std::string e("1 [0, 1); 3 [1, 1]; 5 (1, 2]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test subtly improper intervals.
@@ -248,7 +248,7 @@ int test_main(int, char*[])
     int const n = 5;
     double const d[n] = {0, 0, 0, 0, 0};
     std::string e("1 [0, 0); 3 (1, 2); 5 (2, 2]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test grossly improper intervals.
@@ -256,7 +256,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
     std::string e("1; 9 (2, 0]; 3 [7, 3); 5 (5, 5); 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test intervals with 'holes'. Since the last element is replicated,
@@ -265,7 +265,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {0, 1, 0, 3, 0, 5, 7, 7, 7};
     std::string e("1 [1, 2); 3 [3, 3]; 5 (4, 5]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test overlapping intervals.
@@ -274,7 +274,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {1, 1, 1, 3, 3, 5, 5, 7, 7};
     std::string e("1; 1 (0, 8]; 3 (2, 7]; 5 (4, 6]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test intervals with decreasing begin-points.
@@ -283,7 +283,7 @@ int test_main(int, char*[])
     int const n = 9;
     double const d[n] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
     std::string e("5 [5, 6); 3 [2, 5); 1 [0, 2); 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Durations with '@' prefix mean attained age.
@@ -291,7 +291,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {0, 12, 0, 27, 0, 1, 7, 7, 7, 7};
     std::string e("12 [1, @92); 27 address@hidden, @93]; 1 (@94, 5]; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // Test floating-point values; we choose values that we know
@@ -301,7 +301,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {0, 12.25, 0, 27.875, 0, 1.0625, 7.5, 7.5, 7.5, 7.5};
     std::string e("12.25 [1, @92); 27.875 address@hidden, @93]; 1.0625 (@94, 
5]; 7.5");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
     // {value, @ age} means {value, to-attained-age}
@@ -309,7 +309,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {1, 1, 1, 3, 3, 3, 5, 5, 5, 7};
     std::string e("1 @93; 3 @96; 5 @99; 7");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     }
 
 // TODO ?? Also support and test:
@@ -338,7 +338,7 @@ int test_main(int, char*[])
     k.push_back("c");
     k.push_back("cc");
     k.push_back("ccc");
-    check1(d, n, e, k, c, __FILE__, __LINE__);
+    check1(__FILE__, __LINE__, d, n, e, k, c);
     }
 
     // Test numbers mixed with (enumerative) extra keywords.
@@ -349,7 +349,7 @@ int test_main(int, char*[])
     std::string e("1 [0, 2); keyword_00 [2, 4); 5 [4, 6); 7");
     std::vector<std::string> k;
     k.push_back("keyword_00");
-    check1(d, n, e, k, c, __FILE__, __LINE__);
+    check1(__FILE__, __LINE__, d, n, e, k, c);
     }
 
     // Test numbers mixed with (enumerative) extra keywords, with
@@ -364,7 +364,7 @@ int test_main(int, char*[])
     k.push_back("b");
     k.push_back("x");
     std::string w("x");
-    check2(d, n, e, k, c, w, __FILE__, __LINE__);
+    check2(__FILE__, __LINE__, d, n, e, k, c, w);
     }
 
 // TODO ?? Also test keyword as scalar duration.
@@ -374,7 +374,7 @@ int test_main(int, char*[])
     int const n = 10;
     double const d[n] = {7, 7, 7, 7, 7, 4, 4, 4, 4, 4};
     std::string e("7, retirement; 4");
-    check0(d, n, e, __FILE__, __LINE__);
+    check0(__FILE__, __LINE__, d, n, e);
     InputSequence seq("7, retirement; 4", 10, 90, 95, 0, 2002, 0);
     std::vector<ValueInterval> const& i(seq.interval_representation());
     BOOST_TEST(e_inception  == i[0].begin_mode);



reply via email to

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