]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4088fd] Added number unit tests
authorFrancis Dupont <fdupont@isc.org>
Mon, 9 Nov 2015 12:49:05 +0000 (13:49 +0100)
committerFrancis Dupont <fdupont@isc.org>
Mon, 9 Nov 2015 12:49:05 +0000 (13:49 +0100)
src/lib/eval/tests/context_unittest.cc

index 15a3cb37737f30cba92a7dfded22875a59584b2e..fc5697ed4f332320cb4113487057d22a4d06bb92 100644 (file)
@@ -158,6 +158,22 @@ TEST_F(EvalContextTest, string) {
     checkTokenString(tmp, "foo");
 }
 
+// Test the parsing of a basic expression with a constant string holding
+// a number.
+TEST_F(EvalContextTest, number) {
+
+    EvalContext eval;
+
+    EXPECT_NO_THROW(parsed_ =
+        eval.parseString("substring(option[123], '0', '2') == '42'"));
+    EXPECT_TRUE(parsed_);
+    parsed_ = false;
+    EXPECT_NO_THROW(parsed_ =
+        eval.parseString("untyped: substring(option[123], '0', '2') == '42'"));
+    EXPECT_TRUE(parsed_);
+
+}
+
 // Test the parsing of a hexstring terminal
 TEST_F(EvalContextTest, hexstring) {
     EvalContext eval;