develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34058 - in trunk/languages/ecmascript: src/builtin t

From:
duff
Date:
December 17, 2008 20:13
Subject:
[svn:parrot] r34058 - in trunk/languages/ecmascript: src/builtin t
Message ID:
20081218041312.EA819CBA12@x12.develooper.com
Author: duff
Date: Wed Dec 17 20:13:11 2008
New Revision: 34058

Added:
   trunk/languages/ecmascript/t/02-operators.t
Modified:
   trunk/languages/ecmascript/src/builtin/builtins.pir

Log:
[ecmascript] Added relational ops <, >, <=, >=, and some tests

Modified: trunk/languages/ecmascript/src/builtin/builtins.pir
==============================================================================
--- trunk/languages/ecmascript/src/builtin/builtins.pir	(original)
+++ trunk/languages/ecmascript/src/builtin/builtins.pir	Wed Dec 17 20:13:11 2008
@@ -242,23 +242,31 @@
 .sub 'infix:<'
     .param pmc left
     .param pmc right
+    $I0 = islt left, right
+    .return ($I0)
 .end
 
 
 .sub 'infix:>'
     .param pmc left
     .param pmc right
+    $I0 = isgt left, right
+    .return ($I0)
 .end
 
 .sub 'infix:<='
     .param pmc left
     .param pmc right
+    $I0 = isle left, right
+    .return ($I0)
 .end
 
 
 .sub 'infix:>='
     .param pmc left
     .param pmc right
+    $I0 = isge left, right
+    .return ($I0)
 .end
 
 

Added: trunk/languages/ecmascript/t/02-operators.t
==============================================================================
--- (empty file)
+++ trunk/languages/ecmascript/t/02-operators.t	Wed Dec 17 20:13:11 2008
@@ -0,0 +1,13 @@
+// Test the relational ops
+
+print ("1..8\n");
+
+if (1 < 7) { print("ok 1\n"); } else { print("nok 1\n"); }
+if (7 < 1) { print("nok 2\n"); } else { print("ok 2\n"); }
+if (1 <= 7) { print("ok 3\n"); } else { print("nok 3\n"); }
+if (7 <= 7) { print("ok 4\n"); } else { print("nok 4\n"); }
+
+if (7 > 3) { print("ok 5\n"); } else { print("nok 5\n"); }
+if (3 > 7) { print("nok 6\n"); } else { print("ok 6\n"); }
+if (7 >= 3) { print("ok 7\n"); } else { print("nok 7\n"); }
+if (3 >= 3) { print("ok 8\n"); } else { print("nok 8\n"); }



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