From 56f5bddb7e2a6267bdfeddf8de601a057aef802f Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周六, 05 12月 2015 23:13:34 +0800
Subject: [PATCH] Extend expression.c tests

---
 libscpi/src/expression.c   |    2 ++
 libscpi/test/test_parser.c |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libscpi/src/expression.c b/libscpi/src/expression.c
index 010b40b..702835c 100644
--- a/libscpi/src/expression.c
+++ b/libscpi/src/expression.c
@@ -245,6 +245,8 @@
             *dimensions = fromDimensions;
             return SCPI_EXPR_OK;
         }
+    } else if (err == SCPI_EXPR_NO_MORE) {
+        err = SCPI_EXPR_ERROR;
     }
 
     return err;
diff --git a/libscpi/test/test_parser.c b/libscpi/test/test_parser.c
index da3ded1..2ce67a1 100644
--- a/libscpi/test/test_parser.c
+++ b/libscpi/test/test_parser.c
@@ -753,6 +753,8 @@
     TEST_NumericListDouble("(12,5:6:3)", 0, FALSE, 12, 0, SCPI_EXPR_OK, 0);
     TEST_NumericListDouble("(12,5:6:3)", 1, TRUE, 5, 6, SCPI_EXPR_OK, 0);
     TEST_NumericListDouble("(12,5:6:3)", 2, FALSE, 0, 0, SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
+    TEST_NumericListDouble("(12,5:)", 2, FALSE, 0, 0, SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
+    TEST_NumericListDouble("aaaa", 2, FALSE, 0, 0, SCPI_EXPR_ERROR, SCPI_ERROR_DATA_TYPE_ERROR);
 }
 
 #define NOPAREN(...) __VA_ARGS__
@@ -821,6 +823,10 @@
 
     TEST_ChannelList("(@1, 2)", 0, 1, FALSE, 1, (1), (0), SCPI_EXPR_OK, 0);
     TEST_ChannelList("(@1, 2)", 1, 1, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
+
+    TEST_ChannelList("(@1,)", 1, 1, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
+    TEST_ChannelList("(@1,2:)", 1, 1, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
+    TEST_ChannelList("abcd", 1, 1, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_DATA_TYPE_ERROR);
 }
 
 

--
Gitblit v1.9.1