diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-26 01:03:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:54 -0500 |
commit | b8c219a270e50f165a326c3657618c78e2ff58c5 (patch) | |
tree | 2841c148f970b8392e0111a5b7e5d9c36d2bb203 /source4/pidl/tests | |
parent | 0e617102ef2091915e43296ef52cede1fcf173c8 (diff) | |
download | samba-b8c219a270e50f165a326c3657618c78e2ff58c5.tar.gz samba-b8c219a270e50f165a326c3657618c78e2ff58c5.tar.bz2 samba-b8c219a270e50f165a326c3657618c78e2ff58c5.zip |
r21534: Add some more tests for wireshark.
(This used to be commit b10432096181cf8e7d729e58a5ab54fac5eaa5fe)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-x | source4/pidl/tests/wireshark-ndr.pl | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/source4/pidl/tests/wireshark-ndr.pl b/source4/pidl/tests/wireshark-ndr.pl index f5229560bd..02eabb8942 100755 --- a/source4/pidl/tests/wireshark-ndr.pl +++ b/source4/pidl/tests/wireshark-ndr.pl @@ -5,12 +5,12 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 11; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes); +use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed); is("Access Mask", field2name("access_mask")); is("Accessmask", field2name("AccessMask")); @@ -25,3 +25,48 @@ is("/* IDL: foo */ is("bla_foo", StripPrefixes("bla_foo", [])); is("foo", StripPrefixes("bla_foo", ["bla"])); is("foo_bla", StripPrefixes("foo_bla", ["bla"])); + +%hf_used = (); +$res{code} = ""; +RegisterInterfaceHandoff({}); +is($res{code}, ""); +ok(not defined($hf_used{hf_bla_opnum})); + +%hf_used = (); +$res{code} = ""; +RegisterInterfaceHandoff({UUID => "uuid", NAME => "bla"}); +is($res{code}, 'void proto_reg_handoff_dcerpc_bla(void) +{ + dcerpc_init_uuid(proto_dcerpc_bla, ett_dcerpc_bla, + &uuid_dcerpc_bla, ver_dcerpc_bla, + bla_dissectors, hf_bla_opnum); +} +'); +is($hf_used{hf_bla_opnum}, 1); + +$conformance = {}; +register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef); +is_deeply($conformance, { + header_fields => { + "hf_bla_idx" => { + INDEX => "hf_bla_idx", + NAME => "bla", + FILTER => "my.filter", + BASE_TYPE => "BASE_HEX", + FT_TYPE => "FT_UINT32", + VALSSTRING => "NULL", + BLURB => undef, + MASK => 0xF + } + }, + hf_renames => {}, + fielddescription => {} +}); + +%hf_used = ( hf_bla => 1 ); +test_warnings("", sub { + CheckUsed({ header_fields => { INDEX => "hf_bla" }})}); + +%hf_used = ( ); +test_warnings("nofile:0: hf field `hf_bla' not used\n", sub { + CheckUsed({ header_fields => { INDEX => "hf_bla" }})}); |