cvsuser 04/12/29 15:15:23
Modified: t/pmc fixedstringarray.t Log: Extend test coverage Revision Changes Path 1.5 +82 -2 parrot/t/pmc/fixedstringarray.t Index: fixedstringarray.t =================================================================== RCS file: /cvs/public/parrot/t/pmc/fixedstringarray.t,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- fixedstringarray.t 16 Dec 2004 19:22:46 -0000 1.4 +++ fixedstringarray.t 29 Dec 2004 23:15:23 -0000 1.5 @@ -1,6 +1,6 @@ #! perl -w # Copyright: 2001-2003 The Perl Foundation. All Rights Reserved. -# $Id: fixedstringarray.t,v 1.4 2004/12/16 19:22:46 chromatic Exp $ +# $Id: fixedstringarray.t,v 1.5 2004/12/29 23:15:23 scog Exp $ =head1 NAME @@ -17,7 +17,7 @@ =cut -use Parrot::Test tests => 9; +use Parrot::Test tests => 13; use Test::More; my $fp_equality_macro = <<'ENDOFMACRO'; @@ -286,4 +286,84 @@ 0 OUTPUT +output_is(<<'CODE', <<'OUTPUT', "Clone"); + new P0, .FixedStringArray + set P0, 3 + set P0[0], "abcde" + set P0[1], "fghi" + set P0[2], "jkl" + clone P1, P0 + set P0[0], "" + set P0[1], "" + set P0[2], "" + set S0, P1[0] + print S0 + set S0, P1[1] + print S0 + set S0, P1[2] + print S0 + print "\n" +CODE +abcdefghijkl +OUTPUT + +output_is(<<'CODE', <<'OUTPUT', "Cloning before size is set"); + new P0, .FixedStringArray + clone P1, P0 + set P0, 10 + set P1, 20 + print "ok\n" + clone P2, P0 + set P2, 30 + end +CODE +ok +FixedStringArray: Can't resize! +OUTPUT +#VIM's syntax highlighter needs this line + +output_is(<<'CODE', <<'OUTPUT', "Truth"); + new P0, .FixedStringArray + unless P0, OK1 + print "not " +OK1: print "ok 1\n" + set P0, 10 + if P0, OK2 + print "not " +OK2: print "ok 2\n" + end +CODE +ok 1 +ok 2 +OUTPUT + +output_is(<<'CODE', <<'OUTPUT', "Garbage collection"); + new P0, .FixedStringArray + set P0, 8192 + set I0, 0 +L1: set P0[I0], I0 + inc I0 + lt I0, 8192, L1 + sweep 1 + set S0, P0[1000] + print S0 + print "\n" + set S0, P0[2000] + print S0 + print "\n" + set S0, P0[4000] + print S0 + print "\n" + set S0, P0[8000] + print S0 + print "\n" + end +CODE +1000 +2000 +4000 +8000 +OUTPUT + 1; +
