summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-05 17:18:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:36:55 -0500
commit42a5a1c550a39febe3ec5f3cc824ebeed29c7d34 (patch)
tree9c1e6b00de2f0002fe9288f086d61333b06e4daa /source4/pidl
parentbc511a646359df17ee21a021a734c149e1e5fc01 (diff)
downloadsamba-42a5a1c550a39febe3ec5f3cc824ebeed29c7d34.tar.gz
samba-42a5a1c550a39febe3ec5f3cc824ebeed29c7d34.tar.bz2
samba-42a5a1c550a39febe3ec5f3cc824ebeed29c7d34.zip
r20556: Add more tests to make sure nothing breaks when I replace the ParseExpr code.
(This used to be commit 0ba52e459bb322a0aee59c6616d7696658934b38)
Diffstat (limited to 'source4/pidl')
-rwxr-xr-xsource4/pidl/tests/util.pl20
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/pidl/tests/util.pl b/source4/pidl/tests/util.pl
index f32ab41e8d..4287d78980 100755
--- a/source4/pidl/tests/util.pl
+++ b/source4/pidl/tests/util.pl
@@ -3,7 +3,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 29;
+use Test::More tests => 41;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use Parse::Pidl::Util;
@@ -57,3 +57,21 @@ is("r->length+r->length",
is("2/2*(r->length)",
ParseExpr("constant/constant*(len)", {"constant" => "2",
"len" => "r->length"}));
+is("2+2-r->length",
+ ParseExpr("constant+constant-len", {"constant" => "2",
+ "len" => "r->length"}));
+is("*r->length", ParseExpr("*len", { "len" => "r->length"}));
+is("**r->length", ParseExpr("**len", { "len" => "r->length"}));
+is("r->length&2", ParseExpr("len&2", { "len" => "r->length"}));
+is("&r->length", ParseExpr("&len", { "len" => "r->length"}));
+is("strlen(\"data\")", ParseExpr("strlen(foo)", { "foo" => "\"data\""}));
+is("strlen(\"data\", 4)", ParseExpr("strlen(foo, 4)", { "foo" => "\"data\""}));
+is("foo / bar", ParseExpr("foo / bar", { "bla" => "\"data\""}));
+is("r->length%2", ParseExpr("len%2", { "len" => "r->length"}));
+is("r->length==2", ParseExpr("len==2", { "len" => "r->length"}));
+is("r->length!=2", ParseExpr("len!=2", { "len" => "r->length"}));
+is("pr->length", ParseExpr("pr->length", { "p" => "r"}));
+TODO: {
+ todo_skip 1, "Broken at the moment";
+ is("r->length", ParseExpr("p->length", { "p" => "r"}));
+}