The enclosed patch adds tests for the new <savec> and <set Sx, Iy> ops,
 and also provides a test for the bug described in my previous email.

 Simon

--- t/op/stacks.t.old   Sun Mar 24 16:35:26 2002
+++ t/op/stacks.t       Sun Mar 24 17:45:23 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 15;
+use Parrot::Test tests => 17;
 use Test::More;

 # Tests for stack operations, currently push*, push_*_c and pop*
@@ -358,6 +358,50 @@
 OUTPUT
 }

+output_is(<<'CODE', <<'OUTPUT', 'save/savec for strings');
+      set S0, "Foobar"
+      savec S0
+      chopn S0, 3
+      print S0
+      print "\n"
+      restore S2
+      print S2
+      print "\n"
+
+      set S1, "Foobar"
+      save  S1
+      chopn S1, 3
+      print S1
+      print "\n"
+      restore S3
+      print S3
+      print "\n"
+
+      end
+CODE
+Foo
+Foobar
+Foo
+Foo
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', 'chunk boundary bug');
+      set I0, 0
+FOO:  set S0, I0
+      savec S0
+      inc I0
+      lt I0, 256, FOO
+
+      rotate_up 2
+
+      restore S1
+      print S1
+      print "\n"
+      end
+CODE
+254
+OUTPUT
+
 ##############################

 # set integer registers to some value given by $code...



--- t/op/string.t.old   Sun Mar 24 16:12:13 2002
+++ t/op/string.t       Sun Mar 24 16:36:34 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 64;
+use Parrot::Test tests => 65;

 output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" );
        set     S4, "JAPH\n"
@@ -797,6 +797,32 @@
  end
 CODE

+output_is(<<'CODE', <<'OUTPUT', 'int -> string');
+     set I5, 1
+     set S5, I5
+     print S5
+     print "\n"
+
+     set S5, -1
+     print S5
+     print "\n"
+
+     set S5, 0b11111111
+     print S5
+     print "\n"
+
+     set S5, 0x0000BEEF
+     print S5
+     print "\n"
+
+     end
+CODE
+1
+-1
+255
+48879
+OUTPUT
+

 # Set all string registers to values given by &$_[0](reg num)
 sub set_str_regs {

Reply via email to