Browse Source

[4483] Extra unit-tests added.

Tomek Mrugalski 8 years ago
parent
commit
33110039ea
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/lib/eval/tests/evaluate_unittest.cc

+ 14 - 0
src/lib/eval/tests/evaluate_unittest.cc

@@ -402,4 +402,18 @@ TEST_F(ExpressionsTest, expressionsPkt4Hlen) {
     testExpression(Option::V4, "pkt4.mac == 0x010203040506", true);
     testExpression(Option::V4, "pkt4.mac == 0x010203040506", true);
 }
 }
 
 
+TEST_F(ExpressionsTest, expressionsPkt4type) {
+
+    // We can inspect the option content directly, but
+    // it requires knowledge of the option type and its format.
+    testExpression(Option::V4, "option[53].hex == 0x0", false);
+    testExpression(Option::V4, "option[53].hex == 0x1", true);
+    testExpression(Option::V4, "option[53].hex == 0x2", false);
+
+    // It's easier to simply use the pkt4.msgtype
+    testExpression(Option::V4, "pkt4.msgtype == 0", false);
+    testExpression(Option::V4, "pkt4.msgtype == 1", true);
+    testExpression(Option::V4, "pkt4.msgtype == 2", false);
+}
+
 };
 };