1 # Copyright (c) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from suite_dfilter
.dfiltertest
import *
9 class TestDfilterDouble
:
11 trace_file
= "icmp.pcapng.gz"
13 def test_eq_1(self
, checkDFilterCount
):
14 dfilter
= "icmp.resptime == 492.204"
15 checkDFilterCount(dfilter
, 1)
17 def test_eq_2(self
, checkDFilterCount
):
18 dfilter
= "icmp.resptime == 492.205"
19 checkDFilterCount(dfilter
, 0)
21 def test_eq_3(self
, checkDFilterCount
):
22 dfilter
= "icmp.resptime == 492204e-3"
23 checkDFilterCount(dfilter
, 1)
25 def test_eq_4(self
, checkDFilterCount
):
26 dfilter
= "icmp.resptime == 492205e-3"
27 checkDFilterCount(dfilter
, 0)
29 def test_ne_1(self
, checkDFilterCount
):
30 dfilter
= "icmp.resptime != 492.204"
31 checkDFilterCount(dfilter
, 0)
33 def test_ne_2(self
, checkDFilterCount
):
34 dfilter
= "icmp.resptime != 492.205"
35 checkDFilterCount(dfilter
, 1)
37 def test_ne_3(self
, checkDFilterCount
):
38 dfilter
= "icmp.resptime != 492204e-3"
39 checkDFilterCount(dfilter
, 0)
41 def test_ne_4(self
, checkDFilterCount
):
42 dfilter
= "icmp.resptime != 492205e-3"
43 checkDFilterCount(dfilter
, 1)
45 def test_gt_1(self
, checkDFilterCount
):
46 dfilter
= "icmp.resptime > 492"
47 checkDFilterCount(dfilter
, 1)
49 def test_gt_2(self
, checkDFilterCount
):
50 dfilter
= "icmp.resptime > 492.203"
51 checkDFilterCount(dfilter
, 1)
53 def test_gt_3(self
, checkDFilterCount
):
54 dfilter
= "icmp.resptime > 493"
55 checkDFilterCount(dfilter
, 0)
57 def test_ge_1(self
, checkDFilterCount
):
58 dfilter
= "icmp.resptime >= 493"
59 checkDFilterCount(dfilter
, 0)
61 def test_ge_2(self
, checkDFilterCount
):
62 dfilter
= "icmp.resptime >= 492"
63 checkDFilterCount(dfilter
, 1)
65 def test_ge_3(self
, checkDFilterCount
):
66 dfilter
= "icmp.resptime >= 492.204"
67 checkDFilterCount(dfilter
, 1)
69 def test_lt_1(self
, checkDFilterCount
):
70 dfilter
= "icmp.resptime < 493"
71 checkDFilterCount(dfilter
, 1)
73 def test_lt_2(self
, checkDFilterCount
):
74 dfilter
= "icmp.resptime < 492"
75 checkDFilterCount(dfilter
, 0)
77 def test_lt_3(self
, checkDFilterCount
):
78 dfilter
= "icmp.resptime < 492.204"
79 checkDFilterCount(dfilter
, 0)
81 def test_le_1(self
, checkDFilterCount
):
82 dfilter
= "icmp.resptime <= 492.204"
83 checkDFilterCount(dfilter
, 1)
85 def test_le_2(self
, checkDFilterCount
):
86 dfilter
= "icmp.resptime <= 493"
87 checkDFilterCount(dfilter
, 1)
89 def test_le_3(self
, checkDFilterCount
):
90 dfilter
= "icmp.resptime <= 492"
91 checkDFilterCount(dfilter
, 0)
93 def test_inf_1(self
, checkDFilterCount
):
94 dfilter
= "icmp.resptime < inf"
95 checkDFilterCount(dfilter
, 1)
97 def test_inf_2(self
, checkDFilterCount
):
98 dfilter
= "icmp.resptime > -infinity"
99 checkDFilterCount(dfilter
, 1)
101 def test_inf_3(self
, checkDFilterCount
):
102 # A protocol can't have the name inf or infinity, but a field can
103 # This is just to check that the filter compiles without error
104 dfilter
= "dvmrp.infinity == 255"
105 checkDFilterCount(dfilter
, 0)
107 def test_nan(self
, checkDFilterCount
):
108 # XXX - We compare NaNs oddly
109 dfilter
= "icmp.resptime == nan"
110 checkDFilterCount(dfilter
, 1)