]> git.imager.perl.org - imager.git/blob - t/t56postfix.t
Initial revision
[imager.git] / t / t56postfix.t
1 BEGIN { $| = 1; print "1..6\n"; }
2 END {print "not ok 1\n" unless $loaded;}
3 use Imager::Expr;
4
5 $loaded = 1;
6 print "ok 1\n";
7
8 #$Imager::DEBUG=1;
9
10 my $expr = Imager::Expr->new({rpnexpr=>'x two * y one + getp1', variables=>[ qw(x y) ], constants=>{one=>1, two=>2}});
11 if ($expr) {
12   print "ok 2\n";
13
14   # perform some basic validation on the code
15   my $code = $expr->dumpcode();
16   my @code = split /\n/, $code;
17   print $code[-1] =~ /:\s+ret/ ? "ok 3\n" : "not ok 3\n";
18   print grep(/:\s+mult.*x/, @code) ? "ok 4\n" : "not ok 4\n";
19   print grep(/:\s+add.*y/, @code) ? "ok 5\n" : "not ok 5\n";
20   print grep(/:\s+getp1/, @code) ? "ok 6\n" : "not ok 6\n";
21 }
22 else {
23   print "not ok 2 ",Imager::Expr::error(),"\n";
24   print "not ok 3 # skip\n";
25   print "not ok 4 # skip\n";
26   print "not ok 5 # skip\n";
27   print "not ok 6 # skip\n";
28 }