aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-07-03 23:07:36 +0100
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-07-04 22:45:14 +0000
commita877f2d5f3ba7a036139f355e7067b002713772c (patch)
treef02c622d6f89640bd7917feace797b9b61fc16d9 /test
parent0fc81c21b240677131d873397c463445e3608ea3 (diff)
dfilter: Allow existence check for slices
Allow checking if a slice exists. The result is true if the slice has length greater than zero. The len() function is implemented as a DFVM instruction instead. The semantics are the same.
Diffstat (limited to 'test')
-rw-r--r--test/suite_dfilter/group_slice.py (renamed from test/suite_dfilter/group_range_method.py)16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/suite_dfilter/group_range_method.py b/test/suite_dfilter/group_slice.py
index 143b223cd0..4aa686c57c 100644
--- a/test/suite_dfilter/group_range_method.py
+++ b/test/suite_dfilter/group_slice.py
@@ -78,3 +78,19 @@ class case_range(unittest.TestCase):
def test_slice_range_5(self, checkDFilterSucceed):
dfilter = "frame[20:] contains :12345678"
checkDFilterSucceed(dfilter)
+
+ def test_slice_exists_1(self, checkDFilterCount):
+ dfilter = "frame[59]"
+ checkDFilterCount(dfilter, 1)
+
+ def test_slice_exists_2(self, checkDFilterCount):
+ dfilter = "frame[60]"
+ checkDFilterCount(dfilter, 0)
+
+ def test_slice_exists_3(self, checkDFilterCount):
+ dfilter = "frame[50-59]"
+ checkDFilterCount(dfilter, 1)
+
+ def test_slice_exists_4(self, checkDFilterCount):
+ dfilter = "frame[50-60]"
+ checkDFilterCount(dfilter, 0)