]> git.imager.perl.org - imager.git/blame - t/t59assem.t
use SvPVbyte() where appropriate for i_io_*write()
[imager.git] / t / t59assem.t
CommitLineData
f7570d04
TC
1#!perl -w
2use strict;
3use Test::More tests => 6;
02d1d628 4
f7570d04 5BEGIN { use_ok('Imager::Expr::Assem') }
02d1d628 6
f7570d04
TC
7SKIP:
8{
9 my $expr = Imager::Expr->new
10 ({assem=><<EOS,
02d1d628
AMH
11 var count:n ; var p:p
12 count = 0
13 p = getp1 x y
14loop:
15# this is just a delay
16 count = add count 1
17 var temp:n
18 temp = lt count totalcount
19 jumpnz temp loop
20 ret p
21EOS
f7570d04
TC
22 variables=>[qw(x y)],
23 constants=>{totalcount=>5}
24 });
25 ok($expr, "compile simple assembler")
26 or do {
27 print "# ", Imager::Expr->error, "\n";
28 skip("didn't compile", 4);
29 };
02d1d628
AMH
30 my $code = $expr->dumpcode();
31 my @code = split /\n/, $code;
f7570d04
TC
32 ok($code[-1] =~ /:\s+ret/, "last op is a ret");
33 ok($code[0] =~ /:\s+set/, "first op is a set");
34 ok($code[1] =~ /:\s+getp1/, "next is a getp1");
35 ok($code[3] =~ /:\s+lt/, "found comparison");
02d1d628 36}