Skip to content

Commit 4e998ed

Browse files
author
David Eriksson
committed
wrote some tests for satellite
1 parent ff39e51 commit 4e998ed

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed

ext/satellite/tests/001.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
See if the satellite extension is loaded
3+
--SKIPIF--
4+
<?php if (!extension_loaded("satellite")) print "skip"; ?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
echo "satellite extension is available";
10+
/*
11+
you can add regression tests for your extension here
12+
13+
the output of your test code has to be equal to the
14+
text in the --EXPECT-- section below for the tests
15+
to pass, differences between the output and the
16+
expected text are interpreted as failure
17+
18+
see php4/tests/README for further information on
19+
writing regression tests
20+
*/
21+
?>
22+
--EXPECT--
23+
satellite extension is available

ext/satellite/tests/002.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Create object of type Random from IOR
3+
--SKIPIF--
4+
<?php if (!extension_loaded("satellite")) print "skip"; ?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
satellite_load_idl("random.idl");
10+
$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
11+
$obj = new OrbitObject($ior);
12+
echo "Random object created";
13+
?>
14+
--EXPECT--
15+
Random object created

ext/satellite/tests/003.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Get a value from an object of type Random
3+
--SKIPIF--
4+
<?php if (!extension_loaded("satellite")) print "skip";
5+
// internet connection needed, try to lookup www.php.net
6+
exec("host www.php.net 2>/dev/null", $output, &$rv);
7+
if ($rv) print "skip";
8+
?>
9+
--POST--
10+
--GET--
11+
--FILE--
12+
<?php
13+
//vim: syntax=php
14+
satellite_load_idl("random.idl");
15+
$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
16+
$obj = new OrbitObject($ior);
17+
$value = $obj->lrand48();
18+
echo "Random value retrieved";
19+
?>
20+
--EXPECT--
21+
Random value retrieved

ext/satellite/tests/004.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Get the IOR of an object
3+
--SKIPIF--
4+
<?php if (!extension_loaded("satellite")) print "skip"; ?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
satellite_load_idl("random.idl");
10+
$ior = "IOR:01a917080f00000049444c3a52616e646f6d3a312e3000000100000000000000500000000101004016000000706c616e7874792e6473672e63732e7463642e69650022062c0000003a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
11+
$obj = new OrbitObject($ior);
12+
$ior2 = satellite_object_to_string($obj);
13+
echo ">$ior2<";
14+
?>
15+
--EXPECT--
16+
>IOR:01a917080f00000049444c3a52616e646f6d3a312e3000000100000000000000500000000101004016000000706c616e7874792e6473672e63732e7463642e69650022062c0000003a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00<

ext/satellite/tests/005.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Satellite compatibility: Create object of type Random
3+
--SKIPIF--
4+
<?php if (!extension_loaded("satellite")) print "skip"; ?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
satellite_load_idl("random.idl");
10+
$ior = "IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00";
11+
$obj = new OrbitObject($ior);
12+
echo "Random object created";
13+
?>
14+
--EXPECT--
15+
Random object created

ext/satellite/tests/random.idl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This interface was copied from http://random.org/corba.html, where you can
2+
// also find the current IOR of the server.
3+
// See client.cc for details.
4+
5+
// IDL
6+
interface Random {
7+
8+
// return non-negative long integer in the interval [0, 2^31)
9+
long lrand48();
10+
11+
// return signed long integer in the interval [-2^31, 2^31)
12+
long mrand48();
13+
};
14+

0 commit comments

Comments
 (0)