develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35513 - trunk/compilers/pirc/t

From:
kjs
Date:
January 13, 2009 14:59
Subject:
[svn:parrot] r35513 - trunk/compilers/pirc/t
Message ID:
20090113225926.3ACDACB9F9@x12.develooper.com
Author: kjs
Date: Tue Jan 13 14:59:25 2009
New Revision: 35513

Modified:
   trunk/compilers/pirc/t/basic.t

Log:
[pirc] some tests.

Modified: trunk/compilers/pirc/t/basic.t
==============================================================================
--- trunk/compilers/pirc/t/basic.t	(original)
+++ trunk/compilers/pirc/t/basic.t	Tue Jan 13 14:59:25 2009
@@ -3,16 +3,71 @@
 # $Id$
 
 use lib "../../lib";
-use Parrot::Test tests => 1;
+use Parrot::Test tests => 3;
 
-pirc_2_pasm_is(<<'CODE', <<'OUTPUT', "a single const declaration");
+pirc_2_pasm_is(<<'CODE', <<'OUTPUT', "a local, a reg and an if-stat");
 .sub main
+    .local int i
+    i = 1
+    $I0 = 1
+    if i == $I0 goto ok
+    say "nok"
+    .return()
+  ok:
     say "ok"
 .end
 CODE
 ok
 OUTPUT
 
+pirc_2_pasm_is(<<'CODE', <<'OUTPUT', "tale of a local, a reg and an unless-stat");
+.sub main
+    .local int i
+    i = 1
+    $I0 = 2
+    unless i == $I0 goto ok
+    say "nok"
+    .return()
+  ok:
+    say "ok"
+.end
+CODE
+ok
+OUTPUT
+
+
+pirc_2_pasm_is(<<'CODE', <<'OUTPUT', "comparison, if, unless");
+.sub main
+    .local int i,j
+    i = 1
+    j = 2
+    if i == j goto L1
+    say "ok"
+    goto L2
+  L1:
+    say "nok"
+  L2:
+    if i != j goto L3
+    say "nok"
+    goto L4
+  L3:
+    say "ok"
+  L4:
+    unless i == j goto L5
+    say "nok"
+    goto L6
+  L5:
+    say "ok"
+  L6:
+.end
+CODE
+ok
+ok
+ok
+OUTPUT
+
+
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4



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