]> git.imager.perl.org - imager.git/blame - t/t56postfix.t
[rt #83212] avoid a possible bad optimizer on centos 5.9
[imager.git] / t / t56postfix.t
CommitLineData
f7570d04
TC
1#!perl -w
2use strict;
3use Test::More tests => 6;
4BEGIN { use_ok('Imager::Expr') }
02d1d628 5
f7570d04
TC
6SKIP:
7{
8 my $expr = Imager::Expr->new({rpnexpr=><<EXPR, variables=>[ qw(x y) ], constants=>{one=>1, two=>2}});
e5744e01
TC
9x two * # see if comments work
10y one +
11getp1
12EXPR
f7570d04
TC
13 ok($expr, "compile postfix")
14 or print "# ", Imager::Expr->error, "\n";
15 $expr
16 or skip("Could not compile", 4);
02d1d628
AMH
17
18 # perform some basic validation on the code
19 my $code = $expr->dumpcode();
20 my @code = split /\n/, $code;
f7570d04
TC
21 ok($code[-1] =~ /:\s+ret/, "ret at the end");
22 ok(grep(/:\s+mult.*x/, @code), "found mult");
23 ok(grep(/:\s+add.*y/, @code), "found add");
24 ok(grep(/:\s+getp1/, @code), "found getp1");
02d1d628 25}