TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / test / suite_dfilter / group_macro.py
blob2137a62f3c754864149b57aedf1e15a63a4734a9
2 # Copyright (c) 2023 by João Valverde <j@v6e.pt>
4 # SPDX-License-Identifier: GPL-2.0-or-later
6 import pytest
7 from suite_dfilter.dfiltertest import *
9 class TestDfilterMacro:
10 trace_file = "http.pcap"
12 def test_macro_1(self, checkDFilterCount):
13 dfilter = "$private_ipv4(ip.src)"
14 checkDFilterCount(dfilter, 1)
16 def test_macro_2(self, checkDFilterCount):
17 dfilter = "${private_ipv4:ip.src}"
18 checkDFilterCount(dfilter, 1)
20 def test_macro_3(self, checkDFilterCount):
21 dfilter = "${private_ipv4;ip.src}"
22 checkDFilterCount(dfilter, 1)
24 class TestDfilterMacroZeroArg:
25 trace_file = "nfs.pcap"
27 def test_macro_1(self, checkDFilterCount):
28 dfilter = "$nfs()"
29 checkDFilterCount(dfilter, 2)
31 def test_macro_2(self, checkDFilterCount):
32 dfilter = "${nfs}"
33 checkDFilterCount(dfilter, 2)
35 def test_macro_3(self, checkDFilterCount):
36 dfilter = "${nfs:}"
37 checkDFilterCount(dfilter, 2)
39 def test_macro_wrong_count_1(self, checkDFilterFail):
40 dfilter = "${private_ipv4}"
41 checkDFilterFail(dfilter, "wrong number of arguments for macro")
43 def test_macro_wrong_count_2(self, checkDFilterFail):
44 dfilter = "${private_ipv4:}"
45 checkDFilterFail(dfilter, "wrong number of arguments for macro")
47 def test_macro_wrong_count_3(self, checkDFilterFail):
48 dfilter = "$private_ipv4()"
49 checkDFilterFail(dfilter, "wrong number of arguments for macro")
51 class TestDfilterMacroNullArg:
52 trace_file = "nfs.pcap"
54 def test_macro_works(self, checkDFilterCount):
55 dfilter = "$ip(198.95.230.20, 2049)"
56 checkDFilterCount(dfilter, 2)
58 def test_macro_null_1(self, checkDFilterFail):
59 dfilter = "$ip(198.95.230.20,)"
60 checkDFilterFail(dfilter, "null argument")
62 def test_macro_null_2(self, checkDFilterFail):
63 dfilter = "${ip:;2049}"
64 checkDFilterFail(dfilter, "null argument")