File: t57infix.t

package info (click to toggle)
libimager-perl 0.50-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,120 kB
  • ctags: 2,907
  • sloc: ansic: 21,092; perl: 15,461; makefile: 56
file content (43 lines) | stat: -rw-r--r-- 1,547 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
BEGIN { $| = 1; print "1..7\n"; }
END {print "not ok 1\n" unless $loaded;}
use Imager::Expr;

$loaded = 1;
print "ok 1\n";

# only test this if Parse::RecDescent was loaded successfully
eval "use Parse::RecDescent";
if (!$@) {
  my $opts = {expr=>'z=0.8;return hsv(x/w*360,y/h,z)', variables=>[ qw(x y) ], constants=>{h=>100,w=>100}};
  my $expr = Imager::Expr->new($opts);
  if ($expr) {
    print "ok 2\n";
    my $code = $expr->dumpcode();
    my @code = split /\n/,$code;
    #print $code;
    print $code[-1] =~ /:\s+ret/ ? "ok 3\n" : "not ok 3\n";
    print grep(/:\s+mult.*360/, @code) ? "ok 4\n" : "not ok 4\n";
    # strength reduction converts these to mults
    #print grep(/:\s+div.*x/, @code) ? "ok 5\n" : "not ok 5\n";
    #print grep(/:\s+div.*y/, @code) ? "ok 6\n" : "not ok 6\n";
    print grep(/:\s+mult.*x/, @code) ? "ok 5\n" : "not ok 5\n";
    print grep(/:\s+mult.*y/, @code) ? "ok 6\n" : "not ok 6\n";
    print grep(/:\s+hsv.*0\.8/, @code) ? "ok 7\n" : "not ok 7\n";
  }
  else {
    print "not ok 2 # ",Imager::Expr::error(),"\n";
    print "not ok 3 # skipped\n";
    print "not ok 4 # skipped\n";
    print "not ok 5 # skipped\n";
    print "not ok 6 # skipped\n";
    print "not ok 7 # skipped\n";
  }
}
else {
  print "ok 2 # skipped - no Parse::RecDescent\n";
  print "ok 3 # skipped - no Parse::RecDescent\n";
  print "ok 4 # skipped - no Parse::RecDescent\n";
  print "ok 5 # skipped - no Parse::RecDescent\n";
  print "ok 6 # skipped - no Parse::RecDescent\n";
  print "ok 7 # skipped - no Parse::RecDescent\n";
}