summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-28 01:51:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:59 -0500
commit4c99e87f9bf30ea3f7e22263ded9f9a0372a73c6 (patch)
treec876886f3f606d277c0ca52ce7623e80b329bcab /source4/pidl/tests
parent240b470f4404b6a3517312827b74f775ae85a855 (diff)
downloadsamba-4c99e87f9bf30ea3f7e22263ded9f9a0372a73c6.tar.gz
samba-4c99e87f9bf30ea3f7e22263ded9f9a0372a73c6.tar.bz2
samba-4c99e87f9bf30ea3f7e22263ded9f9a0372a73c6.zip
r21578: Use utility function for naming pull/push/print functions.
(This used to be commit e0f626b79c43eb59ad3c6e3fb6c267504764bfef)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-xsource4/pidl/tests/ndr_tagtype.pl4
-rwxr-xr-xsource4/pidl/tests/samba-ndr.pl44
2 files changed, 27 insertions, 21 deletions
diff --git a/source4/pidl/tests/ndr_tagtype.pl b/source4/pidl/tests/ndr_tagtype.pl
index efc5b67746..d7839426d5 100755
--- a/source4/pidl/tests/ndr_tagtype.pl
+++ b/source4/pidl/tests/ndr_tagtype.pl
@@ -17,7 +17,7 @@ test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ',
DATA_BLOB result_blob;
r.x = 13;
- if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ if (NT_STATUS_IS_ERR(ndr_push_STRUCT_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
return 1;
result_blob = ndr_push_blob(ndr);
@@ -56,7 +56,7 @@ test_samba4_ndr('struct-notypedef-embedded', 'struct bla { uint8 x; };
DATA_BLOB result_blob;
r.x = 13;
- if (NT_STATUS_IS_ERR(ndr_push_myfn(ndr, NDR_IN, &r)))
+ if (NT_STATUS_IS_ERR(ndr_push_STRUCT_myfn(ndr, NDR_IN, &r)))
return 1;
result_blob = ndr_push_blob(ndr);
diff --git a/source4/pidl/tests/samba-ndr.pl b/source4/pidl/tests/samba-ndr.pl
index d956402e64..a806d33417 100755
--- a/source4/pidl/tests/samba-ndr.pl
+++ b/source4/pidl/tests/samba-ndr.pl
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 34;
+use Test::More tests => 38;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -12,7 +12,7 @@ use Parse::Pidl::Util qw(MyDumper);
use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer
GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv
EnvSubstituteValue NeededFunction NeededElement NeededType $res
- NeededInterface);
+ NeededInterface TypeFunctionName);
my $output;
sub print_fn($) { my $x = shift; $output.=$x; }
@@ -185,28 +185,28 @@ is_deeply($env, { foo => 0, this => "r" });
my $needed = {};
NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed);
-is_deeply($needed, { pull_foo => 1 });
+is_deeply($needed, { ndr_pull_foo => 1 });
# old settings should be kept
-$needed = { pull_foo => 0 };
+$needed = { ndr_pull_foo => 0 };
NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed);
-is_deeply($needed, { pull_foo => 0 });
+is_deeply($needed, { ndr_pull_foo => 0 });
# print/pull/push are independent of each other
-$needed = { pull_foo => 0 };
+$needed = { ndr_pull_foo => 0 };
NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "print", $needed);
-is_deeply($needed, { pull_foo => 0, print_foo => 1 });
+is_deeply($needed, { ndr_pull_foo => 0, ndr_print_foo => 1 });
$needed = { };
NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed);
-is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1,
- pull_bar => 1, print_bar => 1, push_bar => 1});
+is_deeply($needed, { ndr_pull_foo => 1, ndr_print_foo => 1, ndr_push_foo => 1,
+ ndr_pull_bar => 1, ndr_print_bar => 1, ndr_push_bar => 1});
# push/pull/print are always set for functions
-$needed = { pull_foo => 0 };
+$needed = { ndr_pull_foo => 0 };
NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed);
-is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1,
- pull_bar => 1, push_bar => 1, print_bar => 1});
+is_deeply($needed, { ndr_pull_foo => 1, ndr_print_foo => 1, ndr_push_foo => 1,
+ ndr_pull_bar => 1, ndr_push_bar => 1, ndr_print_bar => 1});
# public structs are always needed
$needed = {};
@@ -220,7 +220,7 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1 }, NAME => "bla",
TYPE => "TYPEDEF",
DATA => { TYPE => "STRUCT", ELEMENTS => [] } } ] },
$needed);
-is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1 });
+is_deeply($needed, { ndr_pull_bla => 1, ndr_push_bla => 1, ndr_print_bla => 1 });
# make sure types for elements are set too
$needed = {};
@@ -229,8 +229,8 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1 }, NAME => "bla",
DATA => { TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } } ] },
$needed);
-is_deeply($needed, { pull_bla => 1, pull_bar => 1, push_bla => 1, push_bar => 1,
- print_bla => 1, print_bar => 1});
+is_deeply($needed, { ndr_pull_bla => 1, ndr_pull_bar => 1, ndr_push_bla => 1, ndr_push_bar => 1,
+ ndr_print_bla => 1, ndr_print_bar => 1});
$needed = {};
NeededInterface({ TYPES => [ { PROPERTIES => { gensize => 1}, NAME => "bla",
@@ -241,13 +241,13 @@ NeededInterface({ TYPES => [ { PROPERTIES => { gensize => 1}, NAME => "bla",
is_deeply($needed, { ndr_size_bla => 1 });
# make sure types for elements are set too
-$needed = { pull_bla => 1 };
+$needed = { ndr_pull_bla => 1 };
NeededType({ NAME => "bla",
TYPE => "TYPEDEF",
DATA => { TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } },
$needed, "pull");
-is_deeply($needed, { pull_bla => 1, pull_bar => 1 });
+is_deeply($needed, { ndr_pull_bla => 1, ndr_pull_bar => 1 });
$needed = {};
NeededInterface({ TYPES => [ { PROPERTIES => { public => 1},
@@ -255,8 +255,9 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1},
TYPE => "TYPEDEF",
DATA => { TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "rep" } ] } } ] }, $needed);
-is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1, print_rep => 1,
- pull_bar => 1, push_bar => 1,
+is_deeply($needed, { ndr_pull_bla => 1, ndr_push_bla => 1, ndr_print_bla => 1,
+ ndr_print_rep => 1,
+ ndr_pull_bar => 1, ndr_push_bar => 1,
ndr_bar_to_rep => 1, ndr_rep_to_bar => 1});
$res = "";
@@ -297,3 +298,8 @@ is($res, "if (ndr_flags & NDR_SCALARS) {
if (ndr_flags & NDR_BUFFERS) {
}
");
+
+is(TypeFunctionName("ndr_pull", "uint32"), "ndr_pull_uint32");
+is(TypeFunctionName("ndr_pull", {TYPE => "ENUM", NAME => "bar"}), "ndr_pull_ENUM_bar");
+is(TypeFunctionName("ndr_pull", {TYPE => "TYPEDEF", NAME => "bar", DATA => undef}), "ndr_pull_bar");
+is(TypeFunctionName("ndr_push", {TYPE => "STRUCT", NAME => "bar"}), "ndr_push_STRUCT_bar");