Add license text to dftestlib files, and point to the
[metze/wireshark/wip.git] / tools / dftestlib / range_method.py
1 # Copyright (c) 2013 by Gilbert Ramirez <gram@alumni.rice.edu>
2 #
3 # $Id: dfilter-test.py 52136 2013-09-18 05:07:46Z gram $
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
20 from dftestlib import dftest
21
22 class testRange(dftest.DFTest):
23     trace_file = "ipx_rip.pcap"
24
25     def test_slice_1_pos(self):
26         dfilter = "ipx.src.node[1] == aa"
27         self.assertDFilterCount(dfilter, 1)
28
29     def test_slice_1_neg(self):
30         dfilter = "ipx.src.node[1] == bb"
31         self.assertDFilterCount(dfilter, 0)
32
33     def test_slice_1_hex_pos(self):
34         dfilter = "ipx.src.node[1] == 0xaa"
35         self.assertDFilterCount(dfilter, 1)
36
37     def test_slice_1_hex_neg(self):
38         dfilter = "ipx.src.node[1] == 0xbb"
39         self.assertDFilterCount(dfilter, 0)
40
41     def test_slice_2_pos(self):
42         dfilter = "ipx.src.node[3:2] == a3:e3"
43         self.assertDFilterCount(dfilter, 1)
44
45     def test_slice_2_neg(self):
46         dfilter = "ipx.src.node[3:2] == cc:dd"
47         self.assertDFilterCount(dfilter, 0)