2 # Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 12;
13 t/pmc/fixedintegerarray.t - FixedIntegerArray PMC
17 % prove t/pmc/FixedIntegerArray.t
21 Tests C<FixedIntegerArray> PMC. Checks size, sets various elements, including
22 out-of-bounds test. Checks INT and PMC keys.
26 my $fp_equality_macro = <<'ENDOFMACRO';
27 .macro fp_eq ( J, K, L )
36 gt N2, 0.000001, .$FPEQNOK
56 lt N2, 0.000001, .$FPNENOK
69 pasm_output_is(<<'CODE', <<'OUTPUT', "Setting array size");
70 new P0,.FixedIntegerArray
89 pasm_output_like(<<'CODE', <<'OUTPUT', "Resetting array size (and getting an exception)");
90 new P0, .FixedIntegerArray
95 print "Should have gotten an exception\n "
100 /FixedIntegerArray: Can't resize!
103 #VIM's syntax highlighter needs this line
105 pasm_output_is(<<'CODE', <<'OUTPUT', "Setting first element");
106 new P0, .FixedIntegerArray
134 pasm_output_is(<<'CODE', <<'OUTPUT', "Setting second element");
135 new P0, .FixedIntegerArray
164 pasm_output_like(<<'CODE', <<'OUTPUT', "Setting out-of-bounds elements");
165 new P0, .FixedIntegerArray
172 /FixedIntegerArray: index out of bounds!
176 pasm_output_like(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements");
177 new P0, .FixedIntegerArray
183 /FixedIntegerArray: index out of bounds!
187 pasm_output_like(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements, I");
188 new P0, .FixedIntegerArray
194 /FixedIntegerArray: index out of bounds!
198 pasm_output_like(<<'CODE', <<'OUTPUT', "Getting out-of-bounds elements, -I");
199 new P0, .FixedIntegerArray
205 /FixedIntegerArray: index out of bounds!
210 pasm_output_is(<<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs");
211 @{[ $fp_equality_macro ]}
212 new P0, .FixedIntegerArray
247 pasm_output_is(<<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys");
248 @{[ $fp_equality_macro ]}
249 new P0, .FixedIntegerArray
268 .fp_eq(N0, 10.0, OK2)
293 pir_output_is(<< 'CODE', << 'OUTPUT', "check whether interface is done");
297 pmc1 = new FixedIntegerArray
299 does bool1, pmc1, "scalar"
302 does bool1, pmc1, "array"
305 does bool1, pmc1, "no_interface"
316 pasm_output_is(<<'CODE', <<'OUTPUT', "new_p_i_s");
317 new P0, .FixedIntegerArray, "(1, 17,42,0,77,0b111, 0Xff)"