Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test/php

  • Loading branch information...
commit 262d4d39e103378dabc7fe590e70404b54f015b7 1 parent 36b649d
@badlee authored
View
11 test/php/arithmetics.php
@@ -0,0 +1,11 @@
+<?
+// assertEcho '42'
+function get42() {
+ return 42;
+}
+
+$twentyOne = 21;
+$crazy = 1*get42()-(get42()/2)+3*2+4+1*2+30-$twentyOne;
+
+echo $crazy;
+?>
View
8 test/php/arrayMultiTest.php
@@ -0,0 +1,8 @@
+<?
+// assertEcho 'hello world'
+$arr['foo']['bar'] = 'hello';
+$arr[1] = 'world';
+$arr['foo']['2'] = ' ';
+
+echo $arr['foo']['bar'].$arr['foo'][2].$arr[1];
+?>
View
7 test/php/arrayTest.php
@@ -0,0 +1,7 @@
+<?
+// assertEcho 'hello world'
+$arr['foo'] = 'hello';
+$arr[1] = 'world';
+
+echo $arr['foo'].' '.$arr[1];
+?>
View
16 test/php/binops.php
@@ -0,0 +1,16 @@
+<?
+// assertEcho '011-10111201'
+$a = 1;
+$b = 0;
+
+echo ($a < $b);
+echo ($a > $b);
+echo ($a + $b);
+echo ($b - $a);
+echo ($b . $a);
+echo ($a <= $a);
+echo ($b >= $b);
+echo ($a = $a+$a);
+echo ($a = $a-$a);
+echo ($a = $a+1);
+?>
View
12 test/php/boolTest.php
@@ -0,0 +1,12 @@
+<?
+// assertEcho 'hello world'
+if (true) echo 'hello';
+if (false) echo -1;
+
+$a = true;
+if ($a) { echo ' '; }
+if (!$a) echo -1;
+
+$foo = 'bar';
+if ($foo) echo 'world';
+?>
View
15 test/php/charDataEcho.php
@@ -0,0 +1,15 @@
+<?
+// assertEcho 'hejfarhejfarhej'
+$i = 0;
+$a = true;
+while ($i < 5) {
+ if ($a) {
+ ?>hej<?
+ $a = false;
+ } else {
+ ?>far<?
+ $a = true;
+ }
+ $i = $i+1;
+}
+?>
View
12 test/php/classAttrHelloWorld.php
@@ -0,0 +1,12 @@
+<?
+// assertEcho 'hello world'
+class test {
+ private $foo = 'hello world';
+ function hi() {
+ echo $this->foo;
+ }
+}
+
+$foo = new test();
+$foo->hi();
+?>
View
10 test/php/classConstructorHelloWorld.php
@@ -0,0 +1,10 @@
+<?
+// assertEcho 'hello world'
+class foo {
+ function foo() {
+ echo 'hello world';
+ }
+}
+
+$foo = new foo();
+?>
View
11 test/php/classFunctionHelloWorld.php
@@ -0,0 +1,11 @@
+<?
+// assertEcho 'hello world'
+class bar {
+ function hi() {
+ echo 'hello world';
+ }
+}
+
+$foo = new bar();
+$foo->hi();
+?>
View
9 test/php/echoArrayHelloWorld.php
@@ -0,0 +1,9 @@
+<?
+ // assertEcho 'hello world'
+ $a[0] = 'hello';
+ $b[0] = 'world';
+
+ echo $a[0];
+ echo ' ';
+ echo $b[0];
+?>
View
8 test/php/echoFunctionHelloWorld.php
@@ -0,0 +1,8 @@
+<?
+// assertEcho 'hello world'
+function helloWorld() {
+ return 'hello world';
+}
+
+echo helloWorld();
+?>
View
9 test/php/echoMultiArrayHelloWorld.php
@@ -0,0 +1,9 @@
+<?
+ // assertEcho 'hello world'
+ $a[0][0] = 'hello';
+ $a[0][1] = 'world';
+
+ echo $a[0][0];
+ echo ' ';
+ echo $a[0][1];
+?>
View
9 test/php/funCall.php
@@ -0,0 +1,9 @@
+<?
+// assertEcho 'hello world'
+
+function test($a) {
+ return $a;
+}
+
+echo test('hello world');
+?>
View
7 test/php/varAssignSelf.php
@@ -0,0 +1,7 @@
+<?
+// assertEcho '42'
+$a = 41;
+
+$a = $a+1;
+echo $a;
+?>
View
8 test/php/whileTest.php
@@ -0,0 +1,8 @@
+<?
+// assertEcho '0123456789'
+$i = 0;
+while ($i < 10) {
+ echo $i;
+ $i = $i+1;
+}
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.