1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

r21555: Some tests for TYPE in wireshark conformance files.

This commit is contained in:
Jelmer Vernooij 2007-02-27 12:46:19 +00:00 committed by Gerald (Jerry) Carter
parent c547bce3d3
commit 2a44c8c9c2
2 changed files with 37 additions and 3 deletions

View File

@ -96,7 +96,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT_OK = qw(ReadConformance ReadConformanceFH);
@EXPORT_OK = qw(ReadConformance ReadConformanceFH valid_ft_type valid_base_type);
use strict;

View File

@ -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"); });