summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>1999-07-08 21:42:29 +0000
committerAndrey Hristov <andrey@php.net>1999-07-08 21:42:29 +0000
commitcef4df1fee046105ab35f47c152d39bf16a55a07 (patch)
tree3c633689c360b1682408c0b2410836d357fce59b /tests
parentcb2a2ea9d39c002c0aa2eb06c21da9e48597b032 (diff)
downloadphp-git-cef4df1fee046105ab35f47c152d39bf16a55a07.tar.gz
Reduce clutter a bit.
Diffstat (limited to 'tests')
-rw-r--r--tests/test.php416
-rw-r--r--tests/test.pl34
-rw-r--r--tests/test_class_inheritance29
-rw-r--r--tests/testarray21
-rw-r--r--tests/testarray.pl5
-rw-r--r--tests/testarray25
-rw-r--r--tests/testarray2.pl3
-rw-r--r--tests/testclassfunc10
-rw-r--r--tests/testcom9
-rw-r--r--tests/testfe21
-rw-r--r--tests/testfunc36
-rw-r--r--tests/testfunc.pl20
-rw-r--r--tests/testfunc219
-rw-r--r--tests/testfunc2.pl22
-rw-r--r--tests/testfuncref8
-rw-r--r--tests/testinclude5
-rw-r--r--tests/testobj14
17 files changed, 277 insertions, 0 deletions
diff --git a/tests/test.php4 b/tests/test.php4
new file mode 100644
index 0000000000..fdcd51bdbd
--- /dev/null
+++ b/tests/test.php4
@@ -0,0 +1,16 @@
+<?
+function blah($a)
+{
+
+ return $a;
+}
+
+return "cool";
+
+
+for ($for=0; $for<=100000;$for++)
+{
+if ("andi" != blah("andi"))
+{
+print "error";}
+}
diff --git a/tests/test.pl b/tests/test.pl
new file mode 100644
index 0000000000..2502cb1298
--- /dev/null
+++ b/tests/test.pl
@@ -0,0 +1,34 @@
+<?
+
+$i = 0;
+$j = 1;
+
+for ($k=0; $k<1000000; $k = $k+1) {
+ while ($i<10000000) {
+ if (($i%"4")<1) {
+ $i = $i+"1";
+ if ($j%"2") {
+ $i = $i * "2";
+ }
+ } elseif (($i%"4")<2) {
+ $i = $i+"2";
+ if ($j%"2") {
+ $i = $i * "2";
+ }
+ } elseif (($i%"4")<3) {
+ $i = $i+3;
+ if ($j%"2") {
+ $i = $i * "2";
+ }
+ } else {
+ $i = $i+"4";
+ if ($j%"2") {
+ $i = $i * "2";
+ }
+ }
+ $j = $j+1;
+ }
+}
+print $i;
+print "\n";
+
diff --git a/tests/test_class_inheritance b/tests/test_class_inheritance
new file mode 100644
index 0000000000..3f903e62d1
--- /dev/null
+++ b/tests/test_class_inheritance
@@ -0,0 +1,29 @@
+<?
+
+class BaseClass {
+ var $class_name = "BaseClass";
+
+ function BaseClass($value) {
+ print "value is '$value'\n";
+ }
+ function MyClassName() {
+ return $this->class_name;
+ }
+};
+
+
+class ChildClass {
+ var $class_name = "ChildClass";
+
+ function ChildClass($value, $new_value) {
+ BaseClass::BaseClass($value);
+ print "new value is '$new_value'\n";
+ }
+ function MyClassName($a_value) {
+ return BaseClass::MyClassName()." and the value is '$a_value'";
+ }
+};
+
+
+$obj = new ChildClass("Test", "Another test");
+print $obj->MyClassName("not interesting"); \ No newline at end of file
diff --git a/tests/testarray b/tests/testarray
new file mode 100644
index 0000000000..27a2f9bc4d
--- /dev/null
+++ b/tests/testarray
@@ -0,0 +1,21 @@
+
+This is a small test...
+
+<?
+/*
+ * this is a multiline comment...
+ */
+
+//for ($j=0; $j<=200; $j++) {
+ for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
+ $i[1] += $i[0][0]; // this is a single line comment
+ }
+//}
+
+/* this is another multi
+line
+ comment...******
+/
+*/
+
+print $i[1]."\n";
diff --git a/tests/testarray.pl b/tests/testarray.pl
new file mode 100644
index 0000000000..9ec83e184c
--- /dev/null
+++ b/tests/testarray.pl
@@ -0,0 +1,5 @@
+for ($i[0][0]=0; $i[0][0]<1000000; $i[0][0]++) {
+ $i[1] += $i[0][0];
+}
+
+print $i[1];
diff --git a/tests/testarray2 b/tests/testarray2
new file mode 100644
index 0000000000..4272eedf2e
--- /dev/null
+++ b/tests/testarray2
@@ -0,0 +1,5 @@
+<?
+
+for ($i="aaa"; $i<"bbb\nbbb"; $i++) {
+ print $i;
+} \ No newline at end of file
diff --git a/tests/testarray2.pl b/tests/testarray2.pl
new file mode 100644
index 0000000000..e72c526d4f
--- /dev/null
+++ b/tests/testarray2.pl
@@ -0,0 +1,3 @@
+for ($i="aaa"; $i lt "bbb"; $i++) {
+ print "$i\n";
+}
diff --git a/tests/testclassfunc b/tests/testclassfunc
new file mode 100644
index 0000000000..6ad5a5091c
--- /dev/null
+++ b/tests/testclassfunc
@@ -0,0 +1,10 @@
+<?
+
+class foo {
+ function bar() {
+ print "Hey there!\n";
+ }
+};
+
+foo::bar();
+
diff --git a/tests/testcom b/tests/testcom
new file mode 100644
index 0000000000..3668424a29
--- /dev/null
+++ b/tests/testcom
@@ -0,0 +1,9 @@
+<?
+$word = new COM("word.application") or die("Unable to instanciate Word");
+print "Loaded Word, version {$word->Version}\n";
+$word->Visible = 1;
+$word->Documents->Add();
+$word->Selection->TypeText("This is a test...");
+$word->Documents[1]->SaveAs("Useless test.doc");
+$word->Quit();
+?> \ No newline at end of file
diff --git a/tests/testfe b/tests/testfe
new file mode 100644
index 0000000000..5ae85511b5
--- /dev/null
+++ b/tests/testfe
@@ -0,0 +1,21 @@
+<?
+
+$foo = array(7,"foo",3,array(1,2),4);
+
+//print $foo[1];
+
+for ($i=0; $i<3; $i++):
+
+foreach($a, $foo ) {
+ if (gettype($a)=="array") {
+ print "Array:\n";
+ foreach($b, $a) {
+ print "\t$b\n";
+ }
+ print "End of array.\n";
+ } else {
+ print "$a\n";
+ }
+// print "$a\n";
+}
+endfor;
diff --git a/tests/testfunc b/tests/testfunc
new file mode 100644
index 0000000000..6c4775e54f
--- /dev/null
+++ b/tests/testfunc
@@ -0,0 +1,36 @@
+<?
+function foo()
+{
+ $i=0;
+
+ if ($i) {
+ $a = "zeev";
+ } else {
+ $b = "andi";
+ }
+}
+
+
+function bar()
+{
+ foo();
+}
+
+for ($i=0; $i<1000; $i++) {
+ bar();
+}
+
+
+for ($i=0; $i<10; $i++) {
+ bar();
+}
+
+print "Got here...
+
+";
+
+$a = 7;
+
+$a = 5;
+
+print "Got here...\n\n"; \ No newline at end of file
diff --git a/tests/testfunc.pl b/tests/testfunc.pl
new file mode 100644
index 0000000000..87864866ff
--- /dev/null
+++ b/tests/testfunc.pl
@@ -0,0 +1,20 @@
+sub foo()
+{
+ my $i=0;
+
+ if ($i) {
+ my $a = "zeev";
+ } else {
+ my $b = "andi";
+ }
+}
+
+
+sub bar()
+{
+ foo();
+}
+
+for ($i=0; $i<1000000; $i++) {
+ bar();
+}
diff --git a/tests/testfunc2 b/tests/testfunc2
new file mode 100644
index 0000000000..9bcae0f183
--- /dev/null
+++ b/tests/testfunc2
@@ -0,0 +1,19 @@
+<?
+function foo($i)
+{
+ if ($i) {
+ $a = "zeev";
+ } else {
+ $b = "andi";
+ }
+}
+
+
+function bar($a)
+{
+ foo($a);
+}
+
+for ($i=0; $i<1000000; $i=$i+1) {
+ bar($i);
+}
diff --git a/tests/testfunc2.pl b/tests/testfunc2.pl
new file mode 100644
index 0000000000..7eeaf92ffb
--- /dev/null
+++ b/tests/testfunc2.pl
@@ -0,0 +1,22 @@
+sub foo
+{
+ my $i = shift(@_);
+
+ if ($i) {
+ my $a = "zeev";
+ } else {
+ my $b = "andi";
+ }
+}
+
+
+sub bar
+{
+ my $i = shift(@_);
+
+ foo($i);
+}
+
+for ($i=0; $i<1000000; $i=$i+1) {
+ bar($i);
+}
diff --git a/tests/testfuncref b/tests/testfuncref
new file mode 100644
index 0000000000..675c70de81
--- /dev/null
+++ b/tests/testfuncref
@@ -0,0 +1,8 @@
+<?
+
+function foobar()
+{
+ print "foobar\n";
+}
+
+$a = ${"foo"."bar"}();
diff --git a/tests/testinclude b/tests/testinclude
new file mode 100644
index 0000000000..7539985aa7
--- /dev/null
+++ b/tests/testinclude
@@ -0,0 +1,5 @@
+<?
+print "Before include...\n";
+$retval = include("testarray");
+print "After include, include returned $retval\n";
+?> \ No newline at end of file
diff --git a/tests/testobj b/tests/testobj
new file mode 100644
index 0000000000..1c2aa7f2c0
--- /dev/null
+++ b/tests/testobj
@@ -0,0 +1,14 @@
+<?
+
+class foobar {
+ function foobar() {
+ print "foobar!\n";
+ $this->initialized = 1;
+ }
+};
+
+$foo = new foobar; // or die("Unable to construct foobar\n");
+//$word = new COm("word.application");
+//$word->visible = true;
+//sleep(5);
+//$word->quit();