develooper Front page | perl.perl6.internals | Postings from June 2002

[netlabs #723] [PATCH] New stack test

From:
Simon Glover
Date:
June 21, 2002 13:40
Subject:
[netlabs #723] [PATCH] New stack test
Message ID:
rt-723-3402.2.71630525569847@netlabs
# New Ticket Created by  Simon Glover 
# Please include the string:  [netlabs #723]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=723 >



 We've currently got torture tests for the I, S and P stacks, but not for
 the N stack; patch below corrects this.

 Simon

--- t/op/stacks.t.old	Fri Jun 21 16:28:06 2002
+++ t/op/stacks.t	Fri Jun 21 12:47:39 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 32;
+use Parrot::Test tests => 33;
 use Test::More;

 # Tests for stack operations, currently push*, push_*_c and pop*
@@ -155,6 +155,26 @@
 Seem to have positive Nx after pop
 OUTPUT

+$code = $fp_equality_macro;
+$output = "";
+for (0..1024) {
+   $code .= "      set N0, $_\n";
+   $code .= "      set N31, " . (1024-$_) . "\n";
+   $code .= "      pushn\n";
+}
+for (0..1024) {
+   $code .= "      popn\n";
+   $code .= "      .fp_ne(N0," . (1024-$_) . ", FAIL)\n";
+   $code .= "      print \"ok$_\\n\"\n";
+   $code .= "      .fp_ne(N31, $_, FAIL)\n";
+   $code .= "      print \"ok$_\\n\"\n";
+   $output .= "ok$_\n";
+   $output .= "ok$_\n";
+}
+$code .= "      end\n";
+$code .= "FAIL: end\n";
+output_is($code, $output, "pushn & popn (deep)" );
+

 output_is(<<"CODE", <<'OUTPUT', 'pushp & popp');
 	new	P0, .PerlString






nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About