2 # Copyright (C) 2001-2005, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 8;
13 t/pmc/intlist.t - Integer Array
17 % prove t/pmc/intlist.t
21 Tests the C<IntList> PMC. For sparse array tests of C<IntList>, please see
22 F<t/dynpmc/sparse_perlarray.t>.
26 pasm_output_is( <<'CODE', <<'OUTPUT', "creation" );
29 print "Created IntList with "
31 print " elements to start with.\n"
34 Created IntList with 0 elements to start with.
37 # This test just runs way too slowly with GC_DEBUG turned on, so lets
38 # turn it off for make test runs.
39 pasm_output_is( <<'CODE', <<'OUTPUT', "aerobics" );
46 ge I0, I10, postBuildUp
48 add I1, 1 # Push P0, I1++
50 add I1, 1 # Push P0, I1++
52 add I1, 1 # Push P0, I1++
57 ne I2, I3, errFirstPop # fail if pop != I0 * 3 + 2
62 ne I2, I3, errSecondPop # fail if pop != I0 * 3 + 1
66 ne I2, I3, errBuildLen # fail if length != I0 + 1
74 ge I0, I10, postCheckBuildUpLeft
79 branch checkBuildUpLeft
84 ge I0, 0, postCheckBuildUpRight
88 ne I2, I3, errRightGet
90 branch checkBuildUpRight
91 postCheckBuildUpRight:
98 le I0, 0, postTearDown
101 ne I2, I3, errTearCap
106 ne I2, I3, errTearInner
112 ne I2, I0, errTearLength
121 print "I need a shower.\n"
124 print "FAILED: first pop\n"
128 print "FAILED: second pop\n"
132 print "FAILED: buildup length\n"
136 print "FAILED: left get\n"
140 print "FAILED: right get\n"
144 print "FAILED: tear down cap\n"
148 print "FAILED: tear down inner\n"
152 print "FAILED: tear down length\n"
156 print "FAILED: last element (zero)\n"
171 pasm_output_is( <<'CODE', <<'OUTPUT', "direct access 2" );
191 # and pushed value at I0+1
225 pasm_output_is( <<'CODE', <<'OUTPUT', "sparse access" );
245 # and pushed value at I0+1
255 # now repeat and fill some holes
294 pasm_output_is( <<'CODE', <<'OUTPUT', "pop into sparse" );
298 # push some values at start
310 # push some values after hole
359 pasm_output_is( <<'CODE', <<'OUTPUT', "clone" );
396 pasm_output_is( <<'CODE', <<'OUTPUT', "access via a PMC key" );
433 BAD1: print "not ok 1\n"
435 BAD2: print "not ok 2\n"
442 pir_output_is( << 'CODE', << 'OUTPUT', "check whether interface is done" );
448 does bool1, pmc1, "scalar"
451 does bool1, pmc1, "array"
454 does bool1, pmc1, "no_interface"
467 # cperl-indent-level: 4
470 # vim: expandtab shiftwidth=4: