2 # Copyright (C) 2001-2005, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 13;
13 t/pmc/fixedstringarray.t - FixedStringArray PMC
17 % prove t/pmc/FixedStringArray.t
21 Tests C<FixedStringArray> 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,.FixedStringArray
89 pasm_output_like( <<'CODE', <<'OUTPUT', "Resetting array size (and getting an exception)" );
90 new P0, .FixedStringArray
95 print "Should have gotten an exception\n "
100 /FixedStringArray: Can't resize!
104 #VIM's syntax highlighter needs this line
106 pasm_output_is( <<'CODE', <<'OUTPUT', "Setting first element" );
107 new P0, .FixedStringArray
122 set P0[0],"muwhahaha"
124 eq S0,"muwhahaha",OK_3
135 pasm_output_is( <<'CODE', <<'OUTPUT', "Setting second element" );
136 new P0, .FixedStringArray
164 pasm_output_like( <<'CODE', <<'OUTPUT', "Setting out-of-bounds elements" );
165 new P0, .FixedStringArray
172 /FixedStringArray: index out of bounds!
176 pasm_output_like( <<'CODE', <<'OUTPUT', "Getting out-of-bounds elements" );
177 new P0, .FixedStringArray
183 /FixedStringArray: index out of bounds!
187 pasm_output_is( <<"CODE", <<'OUTPUT', "Set via PMC keys, access via INTs" );
188 @{[ $fp_equality_macro ]}
189 new P0, .FixedStringArray
224 pasm_output_is( <<"CODE", <<'OUTPUT', "Set via INTs, access via PMC Keys" );
225 @{[ $fp_equality_macro ]}
226 new P0, .FixedStringArray
245 .fp_eq(N0, 10.2, OK2)
270 pir_output_is( << 'CODE', << 'OUTPUT', "check whether interface is done" );
274 pmc1 = new FixedStringArray
276 does bool1, pmc1, "scalar"
279 does bool1, pmc1, "array"
282 does bool1, pmc1, "no_interface"
293 pasm_output_is( <<'CODE', <<'OUTPUT', "Clone" );
294 new P0, .FixedStringArray
315 pasm_output_like( <<'CODE', <<'OUTPUT', "Cloning before size is set" );
316 new P0, .FixedStringArray
326 FixedStringArray: Can't resize!
330 #VIM's syntax highlighter needs this line
332 pasm_output_is( <<'CODE', <<'OUTPUT', "Truth" );
333 new P0, .FixedStringArray
347 pasm_output_is( <<'CODE', <<'OUTPUT', "Garbage collection" );
348 new P0, .FixedStringArray
379 # cperl-indent-level: 4
382 # vim: expandtab shiftwidth=4: