r20556: Add more tests to make sure nothing breaks when I replace the ParseExpr code.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 5 Jan 2007 17:18:22 +0000 (17:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:36:55 +0000 (14:36 -0500)
(This used to be commit 0ba52e459bb322a0aee59c6616d7696658934b38)

source4/pidl/tests/util.pl

index f32ab41e8da3647b721804237fe2cd47b7586dee..4287d78980d59a14a910672203b283fdf28b10c0 100755 (executable)
@@ -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"}));
+}