cvsuser 04/12/29 14:27:12
Modified: t/pmc integer.t
Log:
Tests for ne, gt, ge, istrue and isfalse ops
Revision Changes Path
1.3 +125 -3 parrot/t/pmc/integer.t
Index: integer.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/integer.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- integer.t 16 Dec 2004 19:22:46 -0000 1.2
+++ integer.t 29 Dec 2004 22:27:12 -0000 1.3
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: integer.t,v 1.2 2004/12/16 19:22:46 chromatic Exp $
+# $Id: integer.t,v 1.3 2004/12/29 22:27:12 scog Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 5;
+use Parrot::Test tests => 9;
output_is(<< 'CODE', << 'OUTPUT', "basic math");
##PIR##
@@ -142,7 +142,7 @@
##PIR##
.sub _main
.local pmc pmc1
- pmc1 = new Float
+ pmc1 = new Integer
.local int bool1
does bool1, pmc1, "scalar"
print bool1
@@ -156,3 +156,125 @@
1
0
OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Comparison ops: ne");
+##PIR##
+.sub _main
+ .local pmc pmc1
+ pmc1 = new Integer
+ .local int int1
+ pmc1 = 10
+ int1 = 20
+ ne pmc1, int1, OK1
+ print "not "
+OK1:
+ print "ok 1\n"
+ int1 = 10
+ ne pmc1, int1, BAD2
+ branch OK2
+BAD2:
+ print "not "
+OK2:
+ print "ok 2\n"
+ end
+.end
+CODE
+ok 1
+ok 2
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Comparison ops: gt");
+##PIR##
+.sub _main
+ .local pmc pmc1
+ pmc1 = new Integer
+ .local int int1
+ pmc1 = 10
+ int1 = 5
+ gt pmc1, int1, OK1
+ print "not "
+OK1:
+ print "ok 1\n"
+ int1 = 10
+ gt pmc1, int1, BAD2
+ branch OK2
+BAD2:
+ print "not "
+OK2:
+ print "ok 2\n"
+ int1 = 20
+ gt pmc1, int1, BAD3
+ branch OK3
+BAD3:
+ print "not "
+OK3:
+ print "ok 3\n"
+ end
+.end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Comparison ops: ge");
+##PIR##
+.sub _main
+ .local pmc pmc1
+ pmc1 = new Integer
+ .local int int1
+ pmc1 = 10
+ int1 = 5
+ ge pmc1, int1, OK1
+ print "not "
+OK1:
+ print "ok 1\n"
+ int1 = 10
+ ge pmc1, int1, OK2
+ print "not "
+OK2:
+ print "ok 2\n"
+ int1 = 20
+ ge pmc1, int1, BAD3
+ branch OK3
+BAD3:
+ print "not "
+OK3:
+ print "ok 3\n"
+ end
+.end
+CODE
+ok 1
+ok 2
+ok 3
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "Logical ops: istrue & isfalse");
+##PIR##
+.sub _main
+ .local pmc pmc1
+ pmc1 = new Integer
+ .local int int1
+ pmc1 = 10
+ istrue int1, pmc1
+ print int1
+ print "\n"
+ isfalse int1, pmc1
+ print int1
+ print "\n"
+ pmc1 = 0
+ istrue int1, pmc1
+ print int1
+ print "\n"
+ isfalse int1, pmc1
+ print int1
+ print "\n"
+
+ end
+.end
+CODE
+1
+0
+0
+1
+OUTPUT