]> granicus.if.org Git - php/commitdiff
wrote some tests for satellite
authorDavid Eriksson <eriksson@php.net>
Sun, 12 Aug 2001 09:23:19 +0000 (09:23 +0000)
committerDavid Eriksson <eriksson@php.net>
Sun, 12 Aug 2001 09:23:19 +0000 (09:23 +0000)
ext/satellite/tests/001.phpt [new file with mode: 0644]
ext/satellite/tests/002.phpt [new file with mode: 0644]
ext/satellite/tests/003.phpt [new file with mode: 0644]
ext/satellite/tests/004.phpt [new file with mode: 0644]
ext/satellite/tests/005.phpt [new file with mode: 0644]
ext/satellite/tests/random.idl [new file with mode: 0644]

diff --git a/ext/satellite/tests/001.phpt b/ext/satellite/tests/001.phpt
new file mode 100644 (file)
index 0000000..1247673
--- /dev/null
@@ -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 (file)
index 0000000..c396b99
--- /dev/null
@@ -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 (file)
index 0000000..1d323f0
--- /dev/null
@@ -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 (file)
index 0000000..faeb974
--- /dev/null
@@ -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 (file)
index 0000000..f76fdd7
--- /dev/null
@@ -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 (file)
index 0000000..54ffd84
--- /dev/null
@@ -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();
+};
+