diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-02-28 00:19:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:48:58 -0500 |
commit | c1aef15fe7e7a7558b6ede11babc1932263814e6 (patch) | |
tree | e0b088f33b3313bedf7aff2060b9d418b313c2e4 /source4/pidl/tests | |
parent | d7a7b7fb0c423c461c24e8157ad926d0cee07da1 (diff) | |
download | samba-c1aef15fe7e7a7558b6ede11babc1932263814e6.tar.gz samba-c1aef15fe7e7a7558b6ede11babc1932263814e6.tar.bz2 samba-c1aef15fe7e7a7558b6ede11babc1932263814e6.zip |
r21573: Remove more code that assumed all types are typedefs.
(This used to be commit bbbfbfa870c44a6148c3d4d47ff409098e85fcc3)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-x | source4/pidl/tests/ndr.pl | 11 | ||||
-rwxr-xr-x | source4/pidl/tests/typelist.pl | 15 |
2 files changed, 23 insertions, 3 deletions
diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl index 9824d1e815..3be5992ef0 100755 --- a/source4/pidl/tests/ndr.pl +++ b/source4/pidl/tests/ndr.pl @@ -4,12 +4,12 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 22; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type); +use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar); # Case 1 @@ -211,3 +211,10 @@ is(align_type({ TYPE => "STRUCT", "NAME" => "bla", ELEMENTS => [ { TYPE => "uint16" } ] }), 4); is(align_type({ TYPE => "STRUCT", "NAME" => "bla", ELEMENTS => [ { TYPE => "uint8" } ] }), 4); + +is(mapToScalar("someverymuchnotexistingtype"), undef); +is(mapToScalar("uint32"), "uint32"); +is(mapToScalar({TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } }), "uint8"); +is(mapToScalar({TYPE => "BITMAP", PROPERTIES => { bitmap64bit => 1 } }), + "hyper"); +is(mapToScalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } }}), "uint8"); diff --git a/source4/pidl/tests/typelist.pl b/source4/pidl/tests/typelist.pl index d84fe0592c..e538cb2e0d 100755 --- a/source4/pidl/tests/typelist.pl +++ b/source4/pidl/tests/typelist.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 38; +use Test::More tests => 50; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -34,14 +34,27 @@ is_deeply(getType("uint16"), { DATA => { NAME => "uint16", TYPE => "SCALAR" }}); is(0, typeIs("someUnknownType", "ENUM")); +is(0, typeIs("foo", "ENUM")); +addType({NAME => "mytypedef", TYPE => "TYPEDEF", DATA => { TYPE => "ENUM" }}); +is(1, typeIs("mytypedef", "ENUM")); +is(0, typeIs("mytypedef", "BITMAP")); +is(1, typeIs({ TYPE => "ENUM"}, "ENUM")); +is(0, typeIs({ TYPE => "BITMAP"}, "ENUM")); +is(1, typeIs("uint32", "SCALAR")); +is(0, typeIs("uint32", "ENUM")); is(1, hasType("foo")); is(0, hasType("nonexistant")); is(0, hasType({TYPE => "ENUM", NAME => "someUnknownType"})); is(1, hasType({TYPE => "ENUM", NAME => "foo"})); +is(1, hasType({TYPE => "ENUM"})); +is(1, hasType({TYPE => "STRUCT"})); is(1, is_scalar("uint32")); is(0, is_scalar("nonexistant")); +is(1, is_scalar({TYPE => "ENUM"})); +is(0, is_scalar({TYPE => "STRUCT"})); +is(1, is_scalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM" }})); is(1, scalar_is_reference("string")); is(0, scalar_is_reference("uint32")); |