sq epan/dissectors/packet-dcerpc-netlogon.c
[wireshark-sm.git] / test / suite_dfilter / group_integer.py
blobf061ad0e40f12fa726755302884275858067826e
1 # Copyright (c) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 import pytest
6 from suite_dfilter.dfiltertest import *
9 class TestDfilterInteger:
10 trace_file = "ntp.pcap"
12 def test_eq_1(self, checkDFilterCount):
13 dfilter = "ip.version == 4"
14 checkDFilterCount(dfilter, 1)
16 def test_eq_2(self, checkDFilterCount):
17 dfilter = "ip.version == 6"
18 checkDFilterCount(dfilter, 0)
20 def test_eq_3(self, checkDFilterFail):
21 # Invalid filter (only one equals sign)
22 dfilter = "ip.version = 4"
23 error = '"=" was unexpected in this context.'
24 checkDFilterFail(dfilter, error)
26 def test_eq_4(self, checkDFilterFail):
27 # Invalid filter
28 dfilter = "ip.version == the quick brown fox jumps over the lazy dog"
29 error = '"quick" was unexpected in this context.'
30 checkDFilterFail(dfilter, error)
32 def test_eq_5(self, checkDFilterFail):
33 # Invalid filter
34 dfilter = "ip.version == 4 the quick brown fox jumps over the lazy dog"
35 error = '"the" was unexpected in this context.'
36 checkDFilterFail(dfilter, error)
38 def test_eq_6(self, checkDFilterCount):
39 dfilter = "udp.srcport == 123"
40 checkDFilterCount(dfilter, 1)
42 def test_eq_7(self, checkDFilterCount):
43 dfilter = "udp.srcport == 0173"
44 checkDFilterCount(dfilter, 1)
46 def test_eq_8(self, checkDFilterCount):
47 dfilter = "udp.srcport == 0x7B"
48 checkDFilterCount(dfilter, 1)
50 def test_eq_9(self, checkDFilterCount):
51 dfilter = "udp.srcport == 0b1111011"
52 checkDFilterCount(dfilter, 1)
54 def test_ne_1(self, checkDFilterCount):
55 dfilter = "ip.version != 0"
56 checkDFilterCount(dfilter, 1)
58 def test_ne_2(self, checkDFilterCount):
59 dfilter = "ip.version != 4"
60 checkDFilterCount(dfilter, 0)
62 def test_u_gt_1(self, checkDFilterCount):
63 dfilter = "ip.version > 3"
64 checkDFilterCount(dfilter, 1)
66 def test_u_gt_2(self, checkDFilterCount):
67 dfilter = "ip.version > 4"
68 checkDFilterCount(dfilter, 0)
70 def test_u_gt_3(self, checkDFilterCount):
71 dfilter = "ip.version > 5"
72 checkDFilterCount(dfilter, 0)
74 def test_u_ge_1(self, checkDFilterCount):
75 dfilter = "ip.version >= 3"
76 checkDFilterCount(dfilter, 1)
78 def test_u_ge_2(self, checkDFilterCount):
79 dfilter = "ip.version >= 4"
80 checkDFilterCount(dfilter, 1)
82 def test_u_ge_3(self, checkDFilterCount):
83 dfilter = "ip.version >= 5"
84 checkDFilterCount(dfilter, 0)
86 def test_u_lt_1(self, checkDFilterCount):
87 dfilter = "ip.version < 3"
88 checkDFilterCount(dfilter, 0)
90 def test_u_lt_2(self, checkDFilterCount):
91 dfilter = "ip.version < 4"
92 checkDFilterCount(dfilter, 0)
94 def test_u_lt_3(self, checkDFilterCount):
95 dfilter = "ip.version < 5"
96 checkDFilterCount(dfilter, 1)
98 def test_u_le_1(self, checkDFilterCount):
99 dfilter = "ip.version <= 3"
100 checkDFilterCount(dfilter, 0)
102 def test_u_le_2(self, checkDFilterCount):
103 dfilter = "ip.version <= 4"
104 checkDFilterCount(dfilter, 1)
106 def test_u_le_3(self, checkDFilterCount):
107 dfilter = "ip.version <= 5"
108 checkDFilterCount(dfilter, 1)
110 def test_s_gt_1(self, checkDFilterCount):
111 dfilter = "ntp.precision > -12"
112 checkDFilterCount(dfilter, 1)
114 def test_s_gt_2(self, checkDFilterCount):
115 dfilter = "ntp.precision > -11"
116 checkDFilterCount(dfilter, 0)
118 def test_s_gt_3(self, checkDFilterCount):
119 dfilter = "ntp.precision > -10"
120 checkDFilterCount(dfilter, 0)
122 def test_s_ge_1(self, checkDFilterCount):
123 dfilter = "ntp.precision >= -12"
124 checkDFilterCount(dfilter, 1)
126 def test_s_ge_2(self, checkDFilterCount):
127 dfilter = "ntp.precision >= -11"
128 checkDFilterCount(dfilter, 1)
130 def test_s_ge_3(self, checkDFilterCount):
131 dfilter = "ntp.precision >= -10"
132 checkDFilterCount(dfilter, 0)
134 def test_s_lt_1(self, checkDFilterCount):
135 dfilter = "ntp.precision < -12"
136 checkDFilterCount(dfilter, 0)
138 def test_s_lt_2(self, checkDFilterCount):
139 dfilter = "ntp.precision < -11"
140 checkDFilterCount(dfilter, 0)
142 def test_s_lt_3(self, checkDFilterCount):
143 dfilter = "ntp.precision < -10"
144 checkDFilterCount(dfilter, 1)
146 def test_s_le_1(self, checkDFilterCount):
147 dfilter = "ntp.precision <= -12"
148 checkDFilterCount(dfilter, 0)
150 def test_s_le_2(self, checkDFilterCount):
151 dfilter = "ntp.precision <= -11"
152 checkDFilterCount(dfilter, 1)
154 def test_s_le_3(self, checkDFilterCount):
155 dfilter = "ntp.precision <= -10"
156 checkDFilterCount(dfilter, 1)
158 def test_s_chained(self, checkDFilterCount):
159 dfilter = "-12 < ntp.precision < -2 < ntp.ppoll < 8"
160 checkDFilterCount(dfilter, 1)
162 def test_bool_eq_1(self, checkDFilterCount):
163 dfilter = "ip.flags.df == 0"
164 checkDFilterCount(dfilter, 1)
166 def test_bool_eq_2(self, checkDFilterCount):
167 dfilter = "ip.flags.df == 1"
168 checkDFilterCount(dfilter, 0)
170 def test_bool_ne_1(self, checkDFilterCount):
171 dfilter = "ip.flags.df != 1"
172 checkDFilterCount(dfilter, 1)
174 def test_bool_ne_2(self, checkDFilterCount):
175 dfilter = "ip.flags.df != 0"
176 checkDFilterCount(dfilter, 0)
178 def test_mixed_gt_1(self, checkDFilterCount):
179 # Compare an unsigned integer to a signed integer.
180 dfilter = "ip.version > ntp.precision"
181 checkDFilterCount(dfilter, 1)
183 class TestDfilterInteger1Byte:
185 trace_file = "ipx_rip.pcap"
187 def test_ipx_1(self, checkDFilterCount):
188 dfilter = "ipx.src.net == 0x28"
189 checkDFilterCount(dfilter, 1)
191 def test_ipx_2(self, checkDFilterCount):
192 dfilter = "ipx.src.net == 0x29"
193 checkDFilterCount(dfilter, 0)
195 class TestDfilterUint64:
196 trace_file = "nfs.pcap"
198 def test_uint64_1(self, checkDFilterCount):
199 dfilter = "nfs.fattr3.size == 264032"
200 checkDFilterCount(dfilter, 1)
202 def test_uint64_2(self, checkDFilterCount):
203 dfilter = "nfs.fattr3.size == 264000"
204 checkDFilterCount(dfilter, 0)