]> git.imager.perl.org - imager.git/blob - t/t59assem.t
prevent const char * to char * conversion warning
[imager.git] / t / t59assem.t
1 BEGIN { $| = 1; print "1..6\n"; }
2 END { print "not ok 1\n" unless $loaded;}
3 use Imager::Expr::Assem;
4
5 $loaded = 1;
6 print "ok 1\n";
7
8 my $expr = Imager::Expr->new
9   ({assem=><<EOS,
10         var count:n ; var p:p
11         count = 0
12         p = getp1 x y
13 loop:
14 # this is just a delay
15         count = add count 1
16         var temp:n
17         temp = lt count totalcount
18         jumpnz temp loop
19         ret p
20 EOS
21     variables=>[qw(x y)],
22     constants=>{totalcount=>5}
23    });
24 if ($expr) {
25   print "ok 2\n";
26   my $code = $expr->dumpcode();
27   my @code = split /\n/, $code;
28   print $code[-1] =~ /:\s+ret/ ? "ok\n" : "not ok # missing ret\n";
29   print $code[0] =~ /:\s+set/ ? "ok\n" : "not ok # missing set\n";
30   print $code[1] =~ /:\s+getp1/ ? "ok\n" : "not ok # missing getp1\n";
31   print $code[3] =~ /:\s+lt/ ? "ok\n" : "not ok # missing lt\n";
32 }
33 else {
34   print "not ok 2 #",Imager::Expr->error(),"\n";
35   for (3..6) {
36     print "not ok $_\n";
37   }
38 }