lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9cd9cfa 2/4: Augment unit tests


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9cd9cfa 2/4: Augment unit tests
Date: Thu, 2 Feb 2017 17:51:56 +0000 (UTC)

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

    Augment unit tests
    
    When testing an all-blank string, it makes sense to test an empty string
    as well.
    
    Previously, no parser error was tested. This test gap was significant
    because the parser will soon be refactored into its own class. Now one
    simple parser error is tested.
---
 input_seq_test.cpp |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/input_seq_test.cpp b/input_seq_test.cpp
index 03bd3dd..ce4c2b0 100644
--- a/input_seq_test.cpp
+++ b/input_seq_test.cpp
@@ -108,6 +108,14 @@ int test_main(int, char*[])
     //     w: default keyword
     //     o: keywords only
 
+    // An empty string is treated as zero.
+    {
+    int const n = 5;
+    double const d[n] = {0, 0, 0, 0, 0};
+    std::string const e("");
+    check(__FILE__, __LINE__, d, n, e);
+    }
+
     // An all-blank string is treated as zero.
     {
     int const n = 9;
@@ -393,6 +401,18 @@ int test_main(int, char*[])
     BOOST_TEST_EQUAL(e_maturity  , i[1].end_mode  );
     }
 
+    // Test a simple parser error.
+    {
+    int const n = 2;
+    double const d[n] = {0, 0};
+    std::string const e("[0, 1)");
+    char const* m =
+        "Expected number or keyword."
+        " Current token '[' at position 1.\n"
+        ;
+    check(__FILE__, __LINE__, d, n, e, m);
+    }
+
     return 0;
 }
 



reply via email to

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