diff options
author | João Valverde <j@v6e.pt> | 2022-04-01 18:44:15 +0100 |
---|---|---|
committer | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2022-04-02 18:10:33 +0000 |
commit | f0ca30b60b89ce601253a0653ffcd01cd8bcb516 (patch) | |
tree | 9389520ea9cd80f25630bd2a9235aaf5f257b781 /test | |
parent | df5941d46750cda2203dbabf59f95ffd3761f67f (diff) |
dfilter: More arithmetic fixes
Fix a failed assertion with constant arithmetic expressions.
Because we do not parse constants on the lexical level it is
more complicated to handle constant expressions with unparsed
values.
We need to handle missing type information gracefully for any
kind of arithmetic expression, not just unary minus.
Diffstat (limited to 'test')
-rw-r--r-- | test/suite_dfilter/group_syntax.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/suite_dfilter/group_syntax.py b/test/suite_dfilter/group_syntax.py index 8d65ddbb87..3dfa84141b 100644 --- a/test/suite_dfilter/group_syntax.py +++ b/test/suite_dfilter/group_syntax.py @@ -182,7 +182,7 @@ class case_unary_minus(unittest.TestCase): checkDFilterCount(dfilter, 0) def test_unary_3(self, checkDFilterFail): - error = 'Left side of "==" expression must be a field or function' + error = 'Constant arithmetic expression on the LHS is invalid' dfilter = "-2 == tcp.dstport" checkDFilterFail(dfilter, error) @@ -194,6 +194,15 @@ class case_arithmetic(unittest.TestCase): dfilter = "udp.dstport == udp.srcport + 1" checkDFilterCount(dfilter, 2) + def test_add_2(self, checkDFilterCount): + dfilter = "udp.dstport == 66 + 1" + checkDFilterCount(dfilter, 2) + + def test_add_3(self, checkDFilterFail): + error = 'Constant arithmetic expression on the LHS is invalid' + dfilter = "2 + 3 == frame.number" + checkDFilterFail(dfilter, error) + def test_sub_1(self, checkDFilterCount): dfilter = "udp.srcport == udp.dstport - 1" checkDFilterCount(dfilter, 2) |