r24560: rename some DCERPC_ prefixes into NDR_
[ira/wip.git] / source / pidl / tests / samba3-cli.pl
index 1d1bae8550210f1b89659e3614fc4150a610331b..733bf93a99858d1538084f9cef4b65ab3bcaa29b 100755 (executable)
@@ -4,27 +4,32 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More tests => 7;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
 use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba3::ClientNDR qw(GenerateFunctionInEnv ParseFunction $res 
-    $res_hdr);
+use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction);
+use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
 
 # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
 my $fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn));
+is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn, "r."));
+is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionOutEnv($fn, "r."));
 
 $fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn));
+is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn, "r."));
+is_deeply({ "foo" => "r.out.foo" }, GenerateFunctionOutEnv($fn, "r."));
 
 $fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
-is_deeply({ }, GenerateFunctionInEnv($fn));
+is_deeply({ }, GenerateFunctionInEnv($fn, "r."));
+is_deeply({ "foo" => "r.out.foo" }, GenerateFunctionOutEnv($fn, "r."));
+
+my $x = new Parse::Pidl::Samba3::ClientNDR();
 
 $fn = { NAME => "bar", ELEMENTS => [ ] };
-ParseFunction("foo", $fn);
-is($res, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+$x->ParseFunction("foo", $fn);
+is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
 {
 \tstruct bar r;
 \tNTSTATUS status;
@@ -34,7 +39,7 @@ is($res, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
 \tif (DEBUGLEVEL >= 10)
 \t\tNDR_PRINT_IN_DEBUG(bar, &r);
 \t
-\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_foo, DCERPC_BAR, &r, (ndr_pull_flags_fn_t)ndr_pull_bar, (ndr_push_flags_fn_t)ndr_push_bar);
+\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_foo, NDR_BAR, &r, (ndr_pull_flags_fn_t)ndr_pull_bar, (ndr_push_flags_fn_t)ndr_push_bar);
 \t
 \tif (!NT_STATUS_IS_OK(status)) {
 \t\treturn status;