- added comment support the postfix transform2() expression
[imager.git] / t / t56postfix.t
CommitLineData
02d1d628
AMH
1BEGIN { $| = 1; print "1..6\n"; }
2END {print "not ok 1\n" unless $loaded;}
3use Imager::Expr;
4
5$loaded = 1;
6print "ok 1\n";
7
8#$Imager::DEBUG=1;
9
e5744e01
TC
10my $expr = Imager::Expr->new({rpnexpr=><<EXPR, variables=>[ qw(x y) ], constants=>{one=>1, two=>2}});
11x two * # see if comments work
12y one +
13getp1
14EXPR
02d1d628
AMH
15if ($expr) {
16 print "ok 2\n";
17
18 # perform some basic validation on the code
19 my $code = $expr->dumpcode();
20 my @code = split /\n/, $code;
21 print $code[-1] =~ /:\s+ret/ ? "ok 3\n" : "not ok 3\n";
22 print grep(/:\s+mult.*x/, @code) ? "ok 4\n" : "not ok 4\n";
23 print grep(/:\s+add.*y/, @code) ? "ok 5\n" : "not ok 5\n";
24 print grep(/:\s+getp1/, @code) ? "ok 6\n" : "not ok 6\n";
25}
26else {
27 print "not ok 2 ",Imager::Expr::error(),"\n";
28 print "not ok 3 # skip\n";
29 print "not ok 4 # skip\n";
30 print "not ok 5 # skip\n";
31 print "not ok 6 # skip\n";
32}