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

[netlabs #748] [PATCH] PMC tests

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



  More extensive tests for the mul_p_p op.

  Simon


--- t/pmc/pmc.t.old	Sat Jun 29 12:58:59 2002
+++ t/pmc/pmc.t	Sat Jun 29 13:19:14 2002
@@ -1,6 +1,6 @@
 #! perl -w

-use Parrot::Test tests => 57;
+use Parrot::Test tests => 58;
 use Test::More;

 my $fp_equality_macro = <<'ENDOFMACRO';
@@ -1259,16 +1259,55 @@ ok 3
 ok 4
 OUTPUT

-output_is(<<CODE, <<OUTPUT, "mul_p_p");
-    new P0,.PerlInt
-    new P1,.PerlInt
-    set P0,8
-    set P1,2
-    mul P0,P1
-    print P0
-    print "\\n"
+output_is(<<CODE, <<OUTPUT, "mul_p_p, PerlInt");
+@{[ $fp_equality_macro ]}
+        new P0,.PerlInt
+        new P1,.PerlInt
+        set P0,8
+        set P1,2
+        mul P0,P1
+        .fp_eq(P0,16,EQ1)
+        print "not "
+EQ1:	print "ok 1"
+        print "\\n"
+
+        new P2, .PerlNum
+        set P2, 0.0625
+        mul P0, P2
+        .fp_eq(P0,1,EQ2)
+        print "not "
+EQ2:	print "ok 2"
+        print "\\n"
+        end
+CODE
+ok 1
+ok 2
+OUTPUT
+
+output_is(<<CODE, <<OUTPUT, "mul_p_p, PerlNum");
+@{[ $fp_equality_macro ]}
+        new P0,.PerlNum
+        new P1,.PerlNum
+        set P0,-2.5
+        set P1,2.5
+        mul P0,P1
+        .fp_eq(P0,-6.25,EQ1)
+        print "not "
+EQ1:	print "ok 1"
+	print "\\n"
+
+        new P2, .PerlInt
+        set P2, 2
+        mul P0, P2
+        .fp_eq(P0,-12.5,EQ2)
+        print "not "
+EQ2:	print "ok 2"
+	print "\\n"
+
+	end
 CODE
-16
+ok 1
+ok 2
 OUTPUT

 1;







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