diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-27 12:46:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:56 -0500 |
commit | 2916cc628ad18ea16e8f1b8521c42963cc7b0a79 (patch) | |
tree | 820ce67b44e2966e59d46aade021984f35510e90 /source4/pidl/tests | |
parent | ad3b40d258e09c7ddbfee387bd46e8b1d22e64c3 (diff) | |
download | samba-2916cc628ad18ea16e8f1b8521c42963cc7b0a79.tar.gz samba-2916cc628ad18ea16e8f1b8521c42963cc7b0a79.tar.bz2 samba-2916cc628ad18ea16e8f1b8521c42963cc7b0a79.zip |
r21555: Some tests for TYPE in wireshark conformance files.
(This used to be commit 2a44c8c9c296462350fcae1960265a6ef0f317d8)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-x | source4/pidl/tests/wireshark-conf.pl | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/source4/pidl/tests/wireshark-conf.pl b/source4/pidl/tests/wireshark-conf.pl index 8601a91ed9..0e6e1e78ac 100755 --- a/source4/pidl/tests/wireshark-conf.pl +++ b/source4/pidl/tests/wireshark-conf.pl @@ -5,12 +5,12 @@ use strict; use warnings; -use Test::More tests => 20; +use Test::More tests => 34; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH); +use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH valid_ft_type valid_base_type); sub parse_conf($) { @@ -60,3 +60,37 @@ is_deeply(parse_conf("CODE START\ndata\nCODE END\n"), { override => "data\n" }); is_deeply(parse_conf("CODE START\ndata\nmore data\nCODE END\n"), { override => "data\nmore data\n" }); test_warnings("nofile:1: Unknown command `CODE'\n", sub { parse_conf("CODE END\n"); } ); + +is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring FT_STRING BASE_DEC 0 0 2\n"), { types => { winreg_String => { + NAME => "winreg_String", + POS => { FILE => "nofile", LINE => 1 }, + USED => 0, + DISSECTOR_NAME => "dissect_myminregstring", + FT_TYPE => "FT_STRING", + BASE_TYPE => "BASE_DEC", + MASK => 0, + VALSSTRING => 0, + ALIGNMENT => 2}}}); + +ok(valid_ft_type("FT_UINT32")); +ok(not valid_ft_type("BLA")); +ok(not valid_ft_type("ft_uint32")); +ok(valid_ft_type("FT_BLA")); + +ok(valid_base_type("BASE_DEC")); +ok(valid_base_type("BASE_HEX")); +ok(not valid_base_type("base_dec")); +ok(not valid_base_type("BLA")); +ok(not valid_base_type("BASEDEC")); + +test_errors("nofile:1: incomplete TYPE command\n", + sub { parse_conf("TYPE mytype dissector\n"); }); + +test_warnings("nofile:1: dissector name does not contain `dissect'\n", + sub { parse_conf("TYPE winreg_String myminregstring FT_STRING BASE_DEC 0 0 2\n"); }); + +test_warnings("nofile:1: invalid FT_TYPE `BLA'\n", + sub { parse_conf("TYPE winreg_String dissect_myminregstring BLA BASE_DEC 0 0 2\n"); }); + +test_warnings("nofile:1: invalid BASE_TYPE `BLOE'\n", + sub { parse_conf("TYPE winreg_String dissect_myminregstring FT_UINT32 BLOE 0 0 2\n"); }); |