summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Eriksson <eriksson@php.net>2001-08-12 09:23:19 +0000
committerDavid Eriksson <eriksson@php.net>2001-08-12 09:23:19 +0000
commit4e998ed80a35acbb812b7093edfc7fd87e9b5419 (patch)
treebe6e3fb0f87e182491cbbd455c69ed52d05d7c33
parentff39e51fdf5b17a20b4ac447e66c3048f03c29d3 (diff)
downloadphp-git-4e998ed80a35acbb812b7093edfc7fd87e9b5419.tar.gz
wrote some tests for satellite
-rw-r--r--ext/satellite/tests/001.phpt23
-rw-r--r--ext/satellite/tests/002.phpt15
-rw-r--r--ext/satellite/tests/003.phpt21
-rw-r--r--ext/satellite/tests/004.phpt16
-rw-r--r--ext/satellite/tests/005.phpt15
-rw-r--r--ext/satellite/tests/random.idl14
6 files changed, 104 insertions, 0 deletions
diff --git a/ext/satellite/tests/001.phpt b/ext/satellite/tests/001.phpt
new file mode 100644
index 0000000000..12476733df
--- /dev/null
+++ b/ext/satellite/tests/001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+See if the satellite extension is loaded
+--SKIPIF--
+<?php if (!extension_loaded("satellite")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?php
+echo "satellite extension is available";
+/*
+ you can add regression tests for your extension here
+
+ the output of your test code has to be equal to the
+ text in the --EXPECT-- section below for the tests
+ to pass, differences between the output and the
+ expected text are interpreted as failure
+
+ see php4/tests/README for further information on
+ writing regression tests
+*/
+?>
+--EXPECT--
+satellite extension is available
diff --git a/ext/satellite/tests/002.phpt b/ext/satellite/tests/002.phpt
new file mode 100644
index 0000000000..c396b99aec
--- /dev/null
+++ b/ext/satellite/tests/002.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Create object of type Random from IOR
+--SKIPIF--
+<?php if (!extension_loaded("satellite")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?php
+satellite_load_idl("random.idl");
+$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
+$obj = new OrbitObject($ior);
+echo "Random object created";
+?>
+--EXPECT--
+Random object created
diff --git a/ext/satellite/tests/003.phpt b/ext/satellite/tests/003.phpt
new file mode 100644
index 0000000000..1d323f0d07
--- /dev/null
+++ b/ext/satellite/tests/003.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Get a value from an object of type Random
+--SKIPIF--
+<?php if (!extension_loaded("satellite")) print "skip";
+// internet connection needed, try to lookup www.php.net
+exec("host www.php.net 2>/dev/null", $output, &$rv);
+if ($rv) print "skip";
+?>
+--POST--
+--GET--
+--FILE--
+<?php
+//vim: syntax=php
+satellite_load_idl("random.idl");
+$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
+$obj = new OrbitObject($ior);
+$value = $obj->lrand48();
+echo "Random value retrieved";
+?>
+--EXPECT--
+Random value retrieved
diff --git a/ext/satellite/tests/004.phpt b/ext/satellite/tests/004.phpt
new file mode 100644
index 0000000000..faeb974a36
--- /dev/null
+++ b/ext/satellite/tests/004.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Get the IOR of an object
+--SKIPIF--
+<?php if (!extension_loaded("satellite")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?php
+satellite_load_idl("random.idl");
+$ior = "IOR:01a917080f00000049444c3a52616e646f6d3a312e3000000100000000000000500000000101004016000000706c616e7874792e6473672e63732e7463642e69650022062c0000003a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
+$obj = new OrbitObject($ior);
+$ior2 = satellite_object_to_string($obj);
+echo ">$ior2<";
+?>
+--EXPECT--
+>IOR:01a917080f00000049444c3a52616e646f6d3a312e3000000100000000000000500000000101004016000000706c616e7874792e6473672e63732e7463642e69650022062c0000003a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00<
diff --git a/ext/satellite/tests/005.phpt b/ext/satellite/tests/005.phpt
new file mode 100644
index 0000000000..f76fdd7ff3
--- /dev/null
+++ b/ext/satellite/tests/005.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Satellite compatibility: Create object of type Random
+--SKIPIF--
+<?php if (!extension_loaded("satellite")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?php
+satellite_load_idl("random.idl");
+$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
+$obj = new OrbitObject($ior);
+echo "Random object created";
+?>
+--EXPECT--
+Random object created
diff --git a/ext/satellite/tests/random.idl b/ext/satellite/tests/random.idl
new file mode 100644
index 0000000000..54ffd84126
--- /dev/null
+++ b/ext/satellite/tests/random.idl
@@ -0,0 +1,14 @@
+// This interface was copied from http://random.org/corba.html, where you can
+// also find the current IOR of the server.
+// See client.cc for details.
+
+// IDL
+interface Random {
+
+ // return non-negative long integer in the interval [0, 2^31)
+ long lrand48();
+
+ // return signed long integer in the interval [-2^31, 2^31)
+ long mrand48();
+};
+