I added some tests which push larger numbers of stack frames- this
improves our coverage in register.c. However, one of the tests is failing
for me. Is this something I did wrong, or did I find a bug?
I'm getting weird output for the pushp and popp (deep) test.
--Josh
Here's the patch:
Index: t/op/stacks.t
===================================================================
RCS file: /cvs/public/parrot/t/op/stacks.t,v
retrieving revision 1.12
diff -u -r1.12 stacks.t
--- t/op/stacks.t 29 Jan 2002 02:32:17 -0000 1.12
+++ t/op/stacks.t 28 Mar 2002 06:12:31 -0000
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 15;
+use Parrot::Test tests => 18;
use Test::More;
# Tests for stack operations, currently push*, push_*_c and pop*
@@ -87,6 +87,23 @@
3031
OUTPUT
+
+my ($code, $output);
+for (0..1024) {
+ $code .= " set I0, $_\n";
+ $code .= " set I31, " . (1024-$_) . "\n";
+ $code .= " pushi\n";
+}
+for (0..1024) {
+ $code .= " popi\n";
+ $code .= " print I0\n";
+ $code .= " print I31\n";
+ $code .= " print \"\\n\"\n";
+ $output .= (1024-$_) . "$_\n";
+}
+output_is($code, $output, "pushi & popi (deep)" );
+
+
output_is(<<"CODE", <<'OUTPUT', 'pushs & pops');
@{[ set_str_regs( sub {$_[0]%2} ) ]}
pushs
@@ -102,6 +119,23 @@
01010101010101010101010101010101
OUTPUT
+
+($code, $output) = ();
+for (0..1024) {
+ $code .= " set S0, \"$_\"\n";
+ $code .= " set S31, \"" . (1024-$_) . "\"\n";
+ $code .= " pushs\n";
+}
+for (0..1024) {
+ $code .= " pops\n";
+ $code .= " print S0\n";
+ $code .= " print S31\n";
+ $code .= " print \"\\n\"\n";
+ $output .= (1024-$_) . "$_\n";
+}
+output_is($code, $output, "pushs & pops (deep)" );
+
+
output_is(<<"CODE", <<'OUTPUT', 'pushn & popn');
@{[ set_num_regs( sub { "1.0".$_ } ) ]}
pushn
@@ -119,6 +153,7 @@
Seem to have positive Nx after pop
OUTPUT
+
output_is(<<"CODE", <<'OUTPUT', 'pushp & popp');
new P0, PerlString
set P0, "BUTTER IN HELL!\\n"
@@ -132,6 +167,25 @@
CODE
THERE'LL BE NO BUTTER IN HELL!
OUTPUT
+
+
+($code, $output) = ();
+for (0..1024) {
+ $code .= " new P0, PerlString\n";
+ $code .= " new P31, PerlString\n";
+ $code .= " set P0, \"$_\"\n";
+ $code .= " set P31, \"" . (1024-$_) . "\"\n";
+ $code .= " pushp\n";
+}
+for (0..1024) {
+ $code .= " popp\n";
+ $code .= " print P0\n";
+ $code .= " print P31\n";
+ $code .= " print \"\\n\"\n";
+ $output .= (1024-$_) . "$_\n";
+}
+output_is($code, $output, "pushp & popp (deep)" );
+
# Test proper stack chunk handling
output_is(<<CODE, <<'OUTPUT', 'save_i & restore_i');