mirror of
https://github.com/php/php-src.git
synced 2024-12-14 12:26:19 +08:00
remove 8 years old tests (not used anyway)
This commit is contained in:
parent
7644677208
commit
ecbecbc60b
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
// Used to print php binary info used to run
|
||||
// test scripts.
|
||||
// Called from run-tests.php
|
||||
|
||||
function dowrite($str)
|
||||
{
|
||||
global $term_bold, $term_norm;
|
||||
$str = str_replace("%b", $term_bold, $str);
|
||||
$str = str_replace("%B", $term_norm, $str);
|
||||
print $str;
|
||||
}
|
||||
|
||||
function dowriteln($str)
|
||||
{
|
||||
dowrite("$str\n");
|
||||
}
|
||||
|
||||
dowriteln("PHP SAPI: ".PHP_SAPI);
|
||||
dowriteln("PHP Version: ".PHP_VERSION);
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?
|
||||
|
||||
print $a->b(12,13)."\n";
|
43
tests/foo3
43
tests/foo3
@ -1,43 +0,0 @@
|
||||
<?
|
||||
|
||||
class foo {
|
||||
function foo() {
|
||||
print "foo()\n";
|
||||
}
|
||||
function bar(&$blah, $foobar=7) {
|
||||
$foobar += 19;
|
||||
}
|
||||
|
||||
function hello_world() {
|
||||
return "Hello, World!";
|
||||
}
|
||||
|
||||
function print_string($str) {
|
||||
print "$str\n";
|
||||
return 666;
|
||||
}
|
||||
var $foo;
|
||||
var $bar="this is a test...";
|
||||
};
|
||||
|
||||
class bar {
|
||||
function foo($a,$b) {
|
||||
$a *= 3;
|
||||
return $a+$b;
|
||||
}
|
||||
function bar(&$blah, $foobar=7) {
|
||||
$foobar += 19;
|
||||
}
|
||||
|
||||
var $foo;
|
||||
var $bar="this is a test...";
|
||||
};
|
||||
|
||||
|
||||
$b = new foo;
|
||||
$a = $b;
|
||||
print $a->print_string($a->hello_world())."\n";
|
||||
print $b->print_string($b->hello_world())."\n";
|
||||
$a->foo = 5;
|
||||
print $a->foo;
|
||||
print $a->foo();
|
41
tests/foo4
41
tests/foo4
@ -1,41 +0,0 @@
|
||||
<?
|
||||
|
||||
class foo {
|
||||
function foo($a,$b) {
|
||||
$a *= 3;
|
||||
return $a+$b;
|
||||
}
|
||||
function bar(&$blah, $foobar=7) {
|
||||
$foobar += 19;
|
||||
}
|
||||
|
||||
function hello_world() {
|
||||
return "Hello, World!";
|
||||
}
|
||||
|
||||
function print_string($str) {
|
||||
print "$str\n";
|
||||
return 666;
|
||||
}
|
||||
var $foo;
|
||||
var $bar="this is a test....";
|
||||
};
|
||||
|
||||
class bar {
|
||||
function foo($a,$b) {
|
||||
$a *= 3;
|
||||
return $a+$b;
|
||||
}
|
||||
function bar(&$blah, $foobar=7) {
|
||||
$foobar += 19;
|
||||
}
|
||||
|
||||
var $foo;
|
||||
var $bar="this is a test...";
|
||||
};
|
||||
|
||||
|
||||
$b = new foo;
|
||||
$a = &$b;
|
||||
$b->asd = 5;
|
||||
print $b->asd;
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
if(($conn = odbc_connect($dsn, $dbuser, $dbpwd))){
|
||||
if(($res = odbc_do($conn, "select gif from php_test where id='$id'"))){
|
||||
odbc_binmode($res, 0);
|
||||
odbc_longreadlen($res, 0);
|
||||
if(odbc_fetch_row($res)){
|
||||
header("content-type: image/gif");
|
||||
odbc_result($res, 1);
|
||||
exit;
|
||||
}else{
|
||||
echo "Error in odbc_fetch_row";
|
||||
}
|
||||
} else {
|
||||
echo "Error in odbc_do";
|
||||
}
|
||||
} else {
|
||||
echo "Error in odbc_connect";
|
||||
}
|
||||
?>
|
@ -1,38 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Quick & dirty ODBC test</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>ODBC Test 1 - Connection</H1>
|
||||
<?php
|
||||
if(isset($dbuser)){
|
||||
echo "Connecting to $dsn as $dbuser\n<P>";
|
||||
$conn = odbc_connect($dsn,$dbuser,$dbpwd);
|
||||
if(!$conn){
|
||||
?>
|
||||
<H2>Error connecting to database! Check DSN, username and password</H2>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<H2>Connection successful</H2>
|
||||
<A HREF="odbc-t2.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
|
||||
| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<EM>You will need permisson to create tables for the following tests!</EM>
|
||||
<form action=odbc-t1.php method=post>
|
||||
<table border=0>
|
||||
<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
|
||||
<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
|
||||
<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type=submit value=connect>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
} ?>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,82 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Quick & dirty ODBC test #2</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>ODBC Test 2 - Create table</H1>
|
||||
<?php
|
||||
if(isset($dbuser)){
|
||||
echo "Connecting to $dsn as $dbuser\n";
|
||||
$conn = odbc_connect($dsn,$dbuser,$dbpwd);
|
||||
if(!$conn){
|
||||
?>
|
||||
<H2>Error connecting to database! Check DSN, username and password</H2>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
- OK<p>
|
||||
Dropping table "php3_test"
|
||||
<?php
|
||||
Error_Reporting(0);
|
||||
$res = odbc_exec($conn,"drop table php_test");
|
||||
if($res){
|
||||
odbc_free_result($res);
|
||||
}
|
||||
?>
|
||||
- OK<p>
|
||||
Create table "php_test"
|
||||
<?php
|
||||
error_reporting(1);
|
||||
$res = odbc_exec($conn, 'create table php_test (a char(16), b integer, c float, d varchar(128))');
|
||||
if($res){
|
||||
odbc_free_result($res);
|
||||
?>
|
||||
- OK<p>
|
||||
Table Info:<br>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Length</th>
|
||||
</tr>
|
||||
<?php
|
||||
$info = odbc_exec($conn,"select * from php_test");
|
||||
$numfields = odbc_num_fields($info);
|
||||
|
||||
for($i=1; $i<=$numfields; $i++){
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo odbc_field_name($info, $i) ?></td>
|
||||
<td><?php echo odbc_field_type($info, $i) ?></td>
|
||||
<td><?php echo odbc_field_len($info,$i) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<P>
|
||||
<HR width=50%">
|
||||
<P>
|
||||
<A HREF="odbc-t3.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
|
||||
| <A HREF="<?php echo $PHP_SELF; ?>">Change login information</A>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
|
||||
<form action="odbc-t3.php" method=post>
|
||||
<table border=0>
|
||||
<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
|
||||
<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
|
||||
<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
|
||||
</table>
|
||||
<input type=submit value="Continue">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,95 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Database test #3</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>ODBC Test 3 - Insert records</H1>
|
||||
<?php
|
||||
if(isset($dbuser)){
|
||||
echo "Connecting to $dsn as $dbuser\n";
|
||||
$conn = odbc_connect($dsn,$dbuser,$dbpwd);
|
||||
if(!$conn){
|
||||
?>
|
||||
<H2>Error connecting to database! Check DSN, username and password</H2>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
- OK<p>
|
||||
Clearing table "php_test"
|
||||
<?php
|
||||
error_reporting(0);
|
||||
$res=odbc_exec($conn,"delete from php_test");
|
||||
odbc_free_result($res);
|
||||
error_reporting(1);
|
||||
?>
|
||||
- OK<p>
|
||||
Inserting into table "php_test"
|
||||
<?php
|
||||
$sqlfloat = '00.0';
|
||||
$sqlint = 1000;
|
||||
$stmt = odbc_prepare($conn, "insert into php_test values(?,?,?,?)");
|
||||
for($i=1; $i<=5; $i++){
|
||||
$values[0] = "test-$i";
|
||||
$values[1] = $sqlint + $i;
|
||||
$values[2] = $i . $sqlfloat . $i;
|
||||
$values[3] = "php - values $i";
|
||||
$ret = odbc_execute($stmt, &$values);
|
||||
}
|
||||
odbc_free_result($stmt);
|
||||
$res = odbc_exec($conn, "select count(*) from php_test");
|
||||
if($res && (odbc_result($res, 1) == 5)){
|
||||
odbc_free_result($res);
|
||||
?>
|
||||
- OK<p>
|
||||
<H3>The table "php_test" should now contain the following values:</H3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>A</th><th>B</th><th>C</th><th>D</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-1</td><td>1001</td><td>100.01</td><td>php - values 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-3</td><td>1003</td><td>300.03</td><td>php - values 3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-4</td><td>1004</td><td>400.04</td><td>php - values 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-5</td><td>1005</td><td>500.05</td><td>php - values 5</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H3>Actual contents of table "php_test":</H3>
|
||||
<?php
|
||||
$res = odbc_exec($conn, "select * from php_test");
|
||||
odbc_result_all($res);
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<HR width="50%">
|
||||
<p>
|
||||
<A HREF="odbc-t4.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
|
||||
| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<form action=odbc-t3.php method=post>
|
||||
<table border=0>
|
||||
<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
|
||||
<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
|
||||
<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
|
||||
</table>
|
||||
<input type=submit value=connect>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
@ -1,91 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Database test #4</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>ODBC Test 4 - Cursors</H1>
|
||||
<em>The following test requires your ODBC driver to support positioned updates</em><p>
|
||||
<?php
|
||||
if(isset($dbuser)){
|
||||
echo "Connecting to $dsn as $dbuser\n";
|
||||
$conn = odbc_connect($dsn,$dbuser,$dbpwd);
|
||||
if(!$conn){
|
||||
?>
|
||||
<H2>Error connecting to database! Check DSN, username and password</H2>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
- OK<p>
|
||||
Updating table "php_test"
|
||||
<?php
|
||||
odbc_autocommit($conn, 0);
|
||||
if(($result = odbc_do($conn, 'select * from php_test where b>1002 for update'))){
|
||||
$cursor = odbc_cursor($result);
|
||||
if(($upd = odbc_prepare($conn,"update php_test set a=?, b=? where current of $cursor"))){
|
||||
while(odbc_fetch_row($result)) {
|
||||
$params[0] = odbc_result($result, 1) . "(*)";
|
||||
$params[1] = odbc_result($result, 2) + 2000;
|
||||
odbc_execute($upd, $params);
|
||||
}
|
||||
odbc_commit($conn);
|
||||
}
|
||||
}
|
||||
if($result && $upd){
|
||||
?>
|
||||
- OK<p>
|
||||
<H3>The table "php_test" should now contain the following values:</H3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>A</th><th>B</th><th>C</th><th>D</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-1</td><td>1001</td><td>100.01</td><td>php3 - values 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-3(*)</td><td>3003</td><td>300.03</td><td>php - values 3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-4(*)</td><td>3004</td><td>400.04</td><td>php - values 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test-5(*)</td><td>3005</td><td>500.05</td><td>php - values 5</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4>
|
||||
<small><em><strong>Note:</strong> If you reload this testpage,<br>
|
||||
the three last rows will contain different<br>values in columns A and B</em></small>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H3>Actual contents of table "php_test":</H3>
|
||||
<?php
|
||||
$res = odbc_exec($conn,"select * from php_test");
|
||||
odbc_result_all($res);
|
||||
}else{
|
||||
echo "Your driver obviously doesn't support positioned updates\n<p>";
|
||||
}
|
||||
?>
|
||||
<p><HR width="50%"><p>
|
||||
<A HREF="odbc-t5.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd"; ?>">Proceed to next test</A>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<form action=odbc-t4.php method=post>
|
||||
<table border=0>
|
||||
<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
|
||||
<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
|
||||
<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
|
||||
</table>
|
||||
<input type=submit value=connect>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,137 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Database test #5</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>ODBC Test 5 - Blobs</H1>
|
||||
<?php
|
||||
if(!isset($gif1file) && !isset($display) ||
|
||||
($gif1file == "none" && $gif2file == "none"
|
||||
&& $gif3file == "none")){
|
||||
?>
|
||||
<H2>Please select the images (gif) you want to put into the database</H2>
|
||||
<FORM METHOD="POST" ACTION="<?php echo $PHP_SELF ?>" ENCTYPE="multipart/form-data">
|
||||
Image 1: <INPUT TYPE="file" NAME="gif1file" VALUE="" SIZE="48"><P>
|
||||
Image 2: <INPUT TYPE="file" NAME="gif2file" VALUE="" SIZE="48"><P>
|
||||
Image 3: <INPUT TYPE="file" NAME="gif3file" VALUE="" SIZE="48"><P>
|
||||
Blob database type name: <INPUT TYPE="text" NAME="datatype" VALUE="LONG BYTE" SIZE="32">
|
||||
<P>
|
||||
<INPUT TYPE="hidden" name="dsn" value="<?php echo $dsn ?>">
|
||||
<INPUT TYPE="hidden" name="dbuser" value="<?php echo $dbuser ?>">
|
||||
<INPUT TYPE="hidden" name="dbpwd" value="<?php echo $dbpwd ?>">
|
||||
<INPUT TYPE="submit" VALUE="Send File(s)">
|
||||
| <INPUT TYPE="reset" VALUE="reset">
|
||||
</FORM>
|
||||
</BODY>
|
||||
</HTML>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($dbuser)){
|
||||
echo "Connecting to $dsn as $dbuser\n";
|
||||
$conn = odbc_connect($dsn, $dbuser, $dbpwd);
|
||||
if(!$conn){
|
||||
?>
|
||||
<H2>Error connecting to database! Check DSN, username and password</H2>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
- OK<p>
|
||||
<?php
|
||||
if(isset($display)){
|
||||
if(($res = odbc_exec($conn, 'select id from php_test'))){
|
||||
echo "<H3>Images in database</H3>";
|
||||
while(odbc_fetch_into($res, &$imgs)){
|
||||
echo "$imgs[0] : <IMG SRC=\"odbc-display.php?id=$imgs[0]&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd\">\n<P>";
|
||||
}
|
||||
}else{
|
||||
echo "Couldn't execute query";
|
||||
}
|
||||
echo "\n</BODY>\n</HTML>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
Dropping table "php_test"
|
||||
<?php
|
||||
Error_Reporting(0);
|
||||
$res = odbc_exec($conn, "drop table php_test");
|
||||
if($res){
|
||||
odbc_free_result($res);
|
||||
}
|
||||
?>
|
||||
- OK<p>
|
||||
Creating table "php_test":
|
||||
<?php
|
||||
$res = odbc_exec($conn, "create table php_test (id char(32), gif $datatype)");
|
||||
if($res){
|
||||
odbc_free_result($res);
|
||||
?>
|
||||
- OK<p>
|
||||
Table Info:<br>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Length</th>
|
||||
</tr>
|
||||
<?php
|
||||
$info = odbc_exec($conn,"select * from php_test");
|
||||
$numfields = odbc_num_fields($info);
|
||||
|
||||
for($i=1; $i<=$numfields; $i++){
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo odbc_field_name($info, $i) ?></td>
|
||||
<td><?php echo odbc_field_type($info, $i) ?></td>
|
||||
<td><?php echo odbc_field_len($info,$i) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
odbc_free_result($info);
|
||||
?>
|
||||
</table>
|
||||
|
||||
Inserting data:
|
||||
<?php
|
||||
echo "$gif1file - $gif2file - $gif3file";
|
||||
|
||||
odbc_free_result($res);
|
||||
$res = odbc_prepare($conn, "insert into php_test values(?,?)");
|
||||
if($gif1file != "none"){
|
||||
$params[0] = "image1";
|
||||
$params[1] = "'$gif1file'";
|
||||
odbc_execute($res, $params);
|
||||
}
|
||||
if($gif2file != "none"){
|
||||
$params[0] = "image2";
|
||||
$params[1] = "'$gif2file'";
|
||||
odbc_execute($res, $params);
|
||||
}
|
||||
if($gif3file != "none"){
|
||||
$params[0] = "image3";
|
||||
$params[1] = "'$gif3file'";
|
||||
odbc_execute($res, $params);
|
||||
}
|
||||
?>
|
||||
- OK<P>
|
||||
<A HREF="<?php echo "$PHP_SELF?display=y&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Display Images</A>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<form action=odbc-t5.php method=post>
|
||||
<table border=0>
|
||||
<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
|
||||
<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
|
||||
<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
|
||||
</table>
|
||||
<input type=submit value=connect>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,21 +0,0 @@
|
||||
<?
|
||||
|
||||
function factorial($n)
|
||||
{
|
||||
if ($n==0 || $n==1) {
|
||||
return 1;
|
||||
} else {
|
||||
return $n*factorial($n-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($k=0; $k<10; $k++):
|
||||
for ($i=0,$sum=0; $i<50; $i++) {
|
||||
$sum = $sum+factorial($i);
|
||||
}
|
||||
endfor;
|
||||
|
||||
print "\$sum=$sum\n";
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<form action="run.php" method="POST">
|
||||
|
||||
<textarea name="code" cols=50 rows=20>
|
||||
</textarea><br>
|
||||
<input type="submit" value="Go!">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,17 +0,0 @@
|
||||
<?
|
||||
if (!isset($code)) {
|
||||
exit("No code submitted.");
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
Executing:<br>
|
||||
<?
|
||||
highlight_string("<?php \n$code\n?>");
|
||||
?>
|
||||
<hr width="40%">
|
||||
<?
|
||||
eval($code);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -1,28 +0,0 @@
|
||||
# Test file used by testscanf.php. Feel free to add additional cases
|
||||
# sscanf test cases. formatted to be slurped and split by explode
|
||||
%d|48| valid decimal (positive)
|
||||
%d|-98| valid signed decimal (negative)
|
||||
%d|56a| integer scan : decimal digit followed by alpha
|
||||
%4d|558071|decimal integer with width specification
|
||||
%i|-5489|valid signed integer (negative)
|
||||
%s| the rain in spain | plain ole string matched with %s
|
||||
%10s|jabberwocky| string with width specifier
|
||||
%f|289.071| valid float (%f)
|
||||
%f|-0.403| valid negative (%f)
|
||||
%3f|76.4|Float with width specifier ending at decimal point
|
||||
%3f"|789.4|Float with width specifier
|
||||
%o|0321|octal with leading 0
|
||||
%o|327| valid octal digits
|
||||
%o|380| octal scan with octal digit followed by non-octal
|
||||
%x|fe| valid hex|
|
||||
%x|0xfe| "c" style hex with leading 0x|
|
||||
%x|455| hex with all single digits < f
|
||||
%x|-98| hex (negative signed int)
|
||||
%c|y| single char
|
||||
%4c|tulips|Character with width specification (4)
|
||||
%e|10e-9| signed floating point with negative exponent
|
||||
%e|10e+9| signed floating point with explicit positive exponent
|
||||
%e|10e9| signed floating point with positive exponent (no + sign)
|
||||
# next we test multiple cases
|
||||
%d %i %o %u %x %s %c %e %f %g | 19 84 0666 2000 0xface your x 31e+9 0.912 2.4 |multiple specifiers
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?
|
||||
|
||||
$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";
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?
|
||||
|
||||
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");
|
@ -1,21 +0,0 @@
|
||||
This is a small test....
|
||||
<?
|
||||
|
||||
/*
|
||||
* this is a multiline comment...
|
||||
*/
|
||||
|
||||
for ($j=0; $j<=20; $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";
|
||||
|
@ -1,5 +0,0 @@
|
||||
for ($i[0][0]=0; $i[0][0]<1000000; $i[0][0]++) {
|
||||
$i[1] += $i[0][0];
|
||||
}
|
||||
|
||||
print $i[1];
|
@ -1,5 +0,0 @@
|
||||
|
||||
<?
|
||||
for ($i="aaa"; $i<"bbb\nbbb"; $i++) {
|
||||
print $i;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
for ($i="aaa"; $i lt "bbb"; $i++) {
|
||||
print "$i\n";
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?
|
||||
class foo {
|
||||
function bar() {
|
||||
print "Hey there!\n";
|
||||
}
|
||||
};
|
||||
|
||||
foo::bar();
|
||||
|
@ -1,11 +0,0 @@
|
||||
<?
|
||||
$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->Quit();
|
||||
/*
|
||||
$word->Documents[1]->SaveAs("Useless test.doc");
|
||||
*/
|
||||
?>
|
@ -1,97 +0,0 @@
|
||||
<?php
|
||||
function draw_text($cpdf, $fontname, $size, $x, $y, $text="") {
|
||||
cpdf_begin_text($cpdf);
|
||||
cpdf_set_font($cpdf, $fontname, $size, 4);
|
||||
if($text == "")
|
||||
cpdf_text($cpdf, $fontname." ".$size." Point", $x, $y, 1);
|
||||
else
|
||||
cpdf_text($cpdf, $text, $x, $y, 1);
|
||||
cpdf_end_text($cpdf);
|
||||
}
|
||||
|
||||
$cpdf = cpdf_open(0);
|
||||
cpdf_set_Creator($cpdf, "Creator");
|
||||
cpdf_set_Title($cpdf, "Title");
|
||||
cpdf_set_Subject($cpdf, "Subject");
|
||||
cpdf_set_Keywords($cpdf, "Keyword1, Keyword2");
|
||||
cpdf_set_viewer_preferences($cpdf, 1);
|
||||
|
||||
cpdf_page_init($cpdf, 1, 0, 600, 400, 1);
|
||||
$level1 = cpdf_add_outline($cpdf, 0, 0, 1, 1, "Examples");
|
||||
$level2a = cpdf_add_outline($cpdf, $level1, 1, 0, 1, "Text");
|
||||
draw_text($cpdf, "Helvetica", 18.0, 50, 330);
|
||||
draw_text($cpdf, "Helvetica-Bold", 18.0, 50, 310);
|
||||
draw_text($cpdf, "Helvetica-Oblique", 18.0, 50, 290);
|
||||
draw_text($cpdf, "Helvetica-BoldOblique", 18.0, 50, 270);
|
||||
draw_text($cpdf, "Times-Roman", 18.0, 50, 250);
|
||||
draw_text($cpdf, "Times-Bold", 18.0, 50, 230);
|
||||
draw_text($cpdf, "Times-Italic", 18.0, 50, 210);
|
||||
draw_text($cpdf, "Times-BoldItalic", 18.0, 50, 190);
|
||||
draw_text($cpdf, "Courier", 18.0, 50, 170);
|
||||
draw_text($cpdf, "Courier-Bold", 18.0, 50, 150);
|
||||
draw_text($cpdf, "Courier-Oblique", 18.0, 50, 130);
|
||||
draw_text($cpdf, "Courier-BoldOblique", 18.0, 50, 110);
|
||||
draw_text($cpdf, "Symbol", 18.0, 50, 90);
|
||||
draw_text($cpdf, "ZapfDingbats", 18.0, 50, 70);
|
||||
|
||||
cpdf_page_init($cpdf, 2, 0, 400, 400, 1);
|
||||
$level2b = cpdf_add_outline($cpdf, $level2a, 0, 0, 2, "Annotations, Hyperlinks");
|
||||
cpdf_add_annotation($cpdf, 100, 100, 300, 200, "Annotation", "Text of Annotation");
|
||||
draw_text($cpdf, "Helvetica", 12.0, 102, 116, "Click here to go to");
|
||||
draw_text($cpdf, "Helvetica", 12.0, 102, 103, "http://localhost");
|
||||
cpdf_set_action_url($cpdf, 100, 100, 202, 130, "http://localhost");
|
||||
|
||||
cpdf_page_init($cpdf, 3, 0, 400, 600, 1);
|
||||
$level2c = cpdf_add_outline($cpdf, $level2b, 0, 0, 3, "Drawing");
|
||||
cpdf_rect($cpdf, 100, 100, 90, 90, 1);
|
||||
cpdf_stroke($cpdf);
|
||||
cpdf_rect($cpdf, 200, 100, 90, 90, 1);
|
||||
cpdf_fill_stroke($cpdf);
|
||||
|
||||
cpdf_setgray_fill($cpdf, 0.5);
|
||||
cpdf_circle($cpdf, 140, 250, 35, 1);
|
||||
cpdf_stroke($cpdf);
|
||||
cpdf_circle($cpdf, 240, 250, 35, 1);
|
||||
cpdf_fill_stroke($cpdf);
|
||||
|
||||
cpdf_moveto($cpdf, 300, 100, 1);
|
||||
cpdf_lineto($cpdf, 350, 100, 1);
|
||||
cpdf_curveto($cpdf, 350, 100, 325, 300, 300, 100, 1);
|
||||
cpdf_stroke($cpdf);
|
||||
|
||||
cpdf_moveto($cpdf, 400, 100, 1);
|
||||
cpdf_lineto($cpdf, 450, 100, 1);
|
||||
cpdf_curveto($cpdf, 450, 100, 425, 400, 400, 100, 1);
|
||||
cpdf_fill_stroke($cpdf);
|
||||
|
||||
cpdf_page_init($cpdf, 4, 0, 400, 600, 1);
|
||||
$level2d = cpdf_add_outline($cpdf, $level2c, 0, 0, 4, "Images, Clipping");
|
||||
cpdf_import_jpeg($cpdf, "figure.jpg", 50, 50, -10.0, 0.0, 300.0, 0.0, 0.0, 1, 1);
|
||||
cpdf_save($cpdf);
|
||||
cpdf_newpath($cpdf);
|
||||
cpdf_moveto($cpdf, 300, 50);
|
||||
cpdf_lineto($cpdf, 450, 50, 1);
|
||||
cpdf_curveto($cpdf, 450, 100, 375, 300, 300, 100, 1);
|
||||
cpdf_closepath($cpdf);
|
||||
cpdf_rect($cpdf, 350, 215, 100, 30);
|
||||
cpdf_clip($cpdf);
|
||||
cpdf_newpath($cpdf); /* needed because clip doesn't consume path */
|
||||
draw_text($cpdf, "Helvetica", 18.0, 250, 130);
|
||||
cpdf_import_jpeg($cpdf, "figure.jpg", 300, 50, 0.0, 0.0, 300.0, 0.0, 0.0, 0, 1); /* watch for the second last parameter. It is 0 to disable extra gsave/grestore */
|
||||
cpdf_restore($cpdf);
|
||||
|
||||
cpdf_page_init($cpdf, 5, 0, 400, 400, 1);
|
||||
$level2e = cpdf_add_outline($cpdf, $level2d, 0, 0, 5, "GD Image");
|
||||
|
||||
$gdimage = imagecreate(100, 100);
|
||||
$color = imagecolorallocate($gdimage, 100, 190, 0);
|
||||
$black = imagecolorallocate($gdimage, 0, 0, 0);
|
||||
imageline($gdimage, 2, 2, 90, 90, $black);
|
||||
|
||||
cpdf_place_inline_image($cpdf, $gdimage, 50, 50, 10.0, 150, 50.0, 1, 1);
|
||||
imagedestroy($gdimage);
|
||||
|
||||
cpdf_finalize($cpdf);
|
||||
cpdf_output_buffer($cpdf);
|
||||
cpdf_close($cpdf);
|
||||
?>
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
$pdffilename = "clock.pdf";
|
||||
$radius = 200;
|
||||
$margin = 20;
|
||||
$pagecount = 99;
|
||||
|
||||
$pdf = cpdf_open(0);
|
||||
cpdf_set_creator($pdf, "pdf_clock.php3");
|
||||
cpdf_set_title($pdf, "Analog Clock");
|
||||
|
||||
while($pagecount-- > 0) {
|
||||
cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);
|
||||
|
||||
cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */
|
||||
|
||||
cpdf_translate($pdf, $radius + $margin, $radius + $margin);
|
||||
cpdf_save($pdf);
|
||||
cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
|
||||
|
||||
/* minute strokes */
|
||||
cpdf_setlinewidth($pdf, 2.0);
|
||||
for ($alpha = 0; $alpha < 360; $alpha += 6)
|
||||
{
|
||||
cpdf_rotate($pdf, 6.0);
|
||||
cpdf_moveto($pdf, $radius, 0.0);
|
||||
cpdf_lineto($pdf, $radius-$margin/3, 0.0);
|
||||
cpdf_stroke($pdf);
|
||||
}
|
||||
|
||||
cpdf_restore($pdf);
|
||||
cpdf_save($pdf);
|
||||
|
||||
/* 5 minute strokes */
|
||||
cpdf_setlinewidth($pdf, 3.0);
|
||||
for ($alpha = 0; $alpha < 360; $alpha += 30)
|
||||
{
|
||||
cpdf_rotate($pdf, 30.0);
|
||||
cpdf_moveto($pdf, $radius, 0.0);
|
||||
cpdf_lineto($pdf, $radius-$margin, 0.0);
|
||||
cpdf_stroke($pdf);
|
||||
}
|
||||
|
||||
$ltime = getdate();
|
||||
|
||||
/* draw hour hand */
|
||||
cpdf_save($pdf);
|
||||
cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0);
|
||||
cpdf_moveto($pdf, -$radius/10, -$radius/20);
|
||||
cpdf_lineto($pdf, $radius/2, 0.0);
|
||||
cpdf_lineto($pdf, -$radius/10, $radius/20);
|
||||
cpdf_closepath($pdf);
|
||||
cpdf_fill($pdf);
|
||||
cpdf_restore($pdf);
|
||||
|
||||
/* draw minute hand */
|
||||
cpdf_save($pdf);
|
||||
cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0);
|
||||
cpdf_moveto($pdf, -$radius/10, -$radius/20);
|
||||
cpdf_lineto($pdf, $radius * 0.8, 0.0);
|
||||
cpdf_lineto($pdf, -$radius/10, $radius/20);
|
||||
cpdf_closepath($pdf);
|
||||
cpdf_fill($pdf);
|
||||
cpdf_restore($pdf);
|
||||
|
||||
/* draw second hand */
|
||||
cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
|
||||
cpdf_setlinewidth($pdf, 2);
|
||||
cpdf_save($pdf);
|
||||
cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
|
||||
cpdf_moveto($pdf, -$radius/5, 0.0);
|
||||
cpdf_lineto($pdf, $radius, 0.0);
|
||||
cpdf_stroke($pdf);
|
||||
cpdf_restore($pdf);
|
||||
|
||||
/* draw little circle at center */
|
||||
cpdf_circle($pdf, 0, 0, $radius/30);
|
||||
cpdf_fill($pdf);
|
||||
|
||||
cpdf_restore($pdf);
|
||||
|
||||
cpdf_finalize_page($pdf, $pagecount+1);
|
||||
}
|
||||
|
||||
cpdf_finalize($pdf);
|
||||
cpdf_save_to_file($pdf, $pdffilename);
|
||||
$pdf = cpdf_close($pdf);
|
||||
?>
|
@ -1,73 +0,0 @@
|
||||
<?php
|
||||
$xmlstr = "<?xml version='1.0' standalone='yes'?>
|
||||
<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
|
||||
[ <!ENTITY sp \"spanish\">
|
||||
]>
|
||||
<!-- lsfj -->
|
||||
<chapter language='en'><title language='en'>Title</title>
|
||||
<para language='ge'>
|
||||
&sp;
|
||||
<!-- comment -->
|
||||
<informaltable language='&sp;kkk'>
|
||||
<tgroup cols='3'>
|
||||
<tbody>
|
||||
<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
|
||||
<row><entry>a2</entry><entry>c2</entry></row>
|
||||
<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</chapter> ";
|
||||
|
||||
echo "Test 1: accessing single nodes from php\n";
|
||||
$dom = xmldoc($xmlstr);
|
||||
if(!$dom) {
|
||||
echo "Error while parsing the document\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$children = $dom->childNodes();
|
||||
print_r($children);
|
||||
|
||||
echo "--------- root\n";
|
||||
$rootnode = $dom->documentElement();
|
||||
print_r($rootnode);
|
||||
|
||||
echo "--------- children of root\n";
|
||||
$children = $rootnode->childNodes();
|
||||
print_r($children);
|
||||
|
||||
// The last node should be identical with the last entry in the children array
|
||||
echo "--------- last\n";
|
||||
$last = $rootnode->lastChild();
|
||||
print_r($last);
|
||||
|
||||
// The parent of this last node is the root again
|
||||
echo "--------- parent\n";
|
||||
$parent = $last->parent();
|
||||
print_r($parent);
|
||||
|
||||
// The children of this parent are the same children as one above
|
||||
echo "--------- children of parent\n";
|
||||
$children = $parent->childNodes();
|
||||
print_r($children);
|
||||
|
||||
echo "--------- creating a new attribute\n";
|
||||
$attr = $dom->createAttribute("src", "picture.gif");
|
||||
print_r($attr);
|
||||
|
||||
$rootnode->setAttributeNode($attr); /* Not implemented */
|
||||
$attr = $rootnode->setAttribute("src", "picture.gif");
|
||||
$attr = $rootnode->getAttribute("src");
|
||||
print_r($attr);
|
||||
|
||||
echo "--------- attribute of rootnode\n";
|
||||
$attrs = $rootnode->attributes();
|
||||
print_r($attrs);
|
||||
|
||||
echo "--------- children of an attribute\n";
|
||||
$children = $attrs[0]->childNodes();
|
||||
print_r($children);
|
||||
|
||||
?>
|
18
tests/testfe
18
tests/testfe
@ -1,18 +0,0 @@
|
||||
<?
|
||||
$foo = array(7,"foo",3,array(1,2),4);
|
||||
|
||||
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;
|
@ -1,33 +0,0 @@
|
||||
<?
|
||||
function foo()
|
||||
{
|
||||
$i=0;
|
||||
|
||||
if ($i) {
|
||||
$a = "zeev";
|
||||
} else {
|
||||
$b = "andi";
|
||||
}
|
||||
}
|
||||
|
||||
function bar()
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
for ($i=0; $i<10; $i++) {
|
||||
bar();
|
||||
}
|
||||
|
||||
|
||||
for ($i=0; $i<10; $i++) {
|
||||
bar();
|
||||
}
|
||||
|
||||
print "Got here.....
|
||||
|
||||
";
|
||||
|
||||
$a = 7;
|
||||
$a = 5;
|
||||
print "Got here....\n\n";
|
@ -1,20 +0,0 @@
|
||||
sub foo()
|
||||
{
|
||||
my $i=0;
|
||||
|
||||
if ($i) {
|
||||
my $a = "zeev";
|
||||
} else {
|
||||
my $b = "andi";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub bar()
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
for ($i=0; $i<1000000; $i++) {
|
||||
bar();
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?
|
||||
function foo($i)
|
||||
{
|
||||
if ($i) {
|
||||
$a = "zeev";
|
||||
} else {
|
||||
$b = "andi";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function bar($a)
|
||||
{
|
||||
foo($a);
|
||||
}
|
||||
|
||||
for ($i=0; $i<10000; $i=$i+1) {
|
||||
bar($i);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?
|
||||
|
||||
function foobar()
|
||||
{
|
||||
print "foobar\n";
|
||||
}
|
||||
|
||||
$foobar = "foobar";
|
||||
|
||||
$a = ${"foo"."bar"}();
|
@ -1,235 +0,0 @@
|
||||
<?
|
||||
$id = 188178; // A plain/text document
|
||||
$collid = 169828; // A collection
|
||||
$query = "Name=m*"; // Search query for test_9
|
||||
$host = "gehtnix";
|
||||
$username = "annonymous";
|
||||
$password = "";
|
||||
|
||||
$connect = hw_connect($host, 418, $username, $password);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Set all test to 'yes' if they shall be executed
|
||||
$test_1 = "no"; // Get the text document with id $id and output it
|
||||
$test_2 = "no"; // Check if id $id is in $collid
|
||||
$test_3 = "no"; // Convert object record to object array and back
|
||||
$test_4 = "no"; // Get object record of object with id $id
|
||||
$test_5 = "no"; // List children of $collid
|
||||
$test_6 = "no"; // List parents of $id
|
||||
$test_7 = "no"; // Insert a new text document
|
||||
$test_8 = "no"; // Remove the just inserted text document
|
||||
$test_9 = "no"; // Searching for objects with Name $query
|
||||
$test_10= "no"; // Listing all anchors of a document
|
||||
$test_11= "no"; // Creates document from file and outputs it.
|
||||
$test_12= "yes"; // Creates document from file and outputs it.
|
||||
|
||||
/* Lists an object array
|
||||
*/
|
||||
function list_attr($attributes) {
|
||||
// var_dump($attributes);
|
||||
// return;
|
||||
for($i=0; $i<count($attributes); $i++) {
|
||||
$key = key($attributes);
|
||||
switch($key) {
|
||||
case "Title":
|
||||
case "Description":
|
||||
$title_arr = $attributes[$key];
|
||||
$cj = count($title_arr);
|
||||
printf("%s = ", $key);
|
||||
for($j=0; $j<$cj; $j++) {
|
||||
$tkey = key($title_arr);
|
||||
switch($tkey) {
|
||||
case "en":
|
||||
$flagfile = "english.gif";
|
||||
break;
|
||||
case "ge":
|
||||
$flagfile = "german.gif";
|
||||
break;
|
||||
case "du":
|
||||
$flagfile = "dutch.gif";
|
||||
break;
|
||||
default:
|
||||
$flagfile = "europe.gif";
|
||||
}
|
||||
printf("%s:%s; ", $tkey, $title_arr[$tkey]);
|
||||
|
||||
next($title_arr);
|
||||
}
|
||||
printf("\n");
|
||||
break;
|
||||
default:
|
||||
if(is_array($attributes[$key])) {
|
||||
$group_arr = $attributes[$key];
|
||||
$cj = count($group_arr);
|
||||
for($j=0; $j<$cj; $j++) {
|
||||
printf("%s = %s\n", $key, $group_arr[$j]);
|
||||
next($group_arr);
|
||||
}
|
||||
} else {
|
||||
printf("%s = %s\n", $key, $attributes[$key]);
|
||||
}
|
||||
|
||||
}
|
||||
next($attributes);
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Here come the tests
|
||||
if($test_1 == "yes") {
|
||||
echo "TEST 1 ----------------------------------------------\n";
|
||||
echo "Get the text document with id 0x".dechex($id)."\n";
|
||||
$doc = hw_gettext($connect, $id);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
hw_output_document($doc);
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
if($test_2 == "yes") {
|
||||
echo "TEST 2 ----------------------------------------------\n";
|
||||
echo "Checking if '$id' (0x".dechex($id).") is in collection '$collid (0x".dechex($collid).")'\n";
|
||||
$incoll = hw_incollections($connect, array($id), array($collid), 0);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
for($i=0; $i<count($incoll); $i++)
|
||||
echo $incoll[$i]."\n";
|
||||
}
|
||||
|
||||
if($test_3 == "yes") {
|
||||
echo "TEST 3 ----------------------------------------------\n";
|
||||
echo "Convert an object array into an object record\n";
|
||||
$objrec = hw_array2objrec(array("Title"=>"ge:Hier der Titel", "Author"=>"Hier der Autor"));
|
||||
echo $objrec."\n";
|
||||
$objrec .= "\nTitle=en:Here the title";
|
||||
echo "Add another title and convert it back to an object array\n";
|
||||
$objarr = hw_objrec2array($objrec);
|
||||
list_attr($objarr);
|
||||
}
|
||||
|
||||
if($test_4 == "yes") {
|
||||
echo "TEST 4 ----------------------------------------------\n";
|
||||
echo "Get the object array of document with id 0x".dechex($id)."\n";
|
||||
$objrec = hw_getobject($connect, $id);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
$objarr = hw_objrec2array($objrec);
|
||||
list_attr($objarr);
|
||||
}
|
||||
|
||||
if($test_5 == "yes") {
|
||||
echo "TEST 5 ----------------------------------------------\n";
|
||||
echo "List the children of collection 0x".dechex($collid)."\n";
|
||||
$children = hw_childrenobj($connect, $collid);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
$c_children = count($children) - 1;
|
||||
for($i=0; $i<$c_children; $i++) {
|
||||
$objarr = hw_objrec2array($children[$i]);
|
||||
list_attr($objarr);
|
||||
}
|
||||
list_attr($children[$c_children]);
|
||||
}
|
||||
|
||||
if($test_6 == "yes") {
|
||||
echo "TEST 6 ----------------------------------------------\n";
|
||||
echo "List the parents of object 0x".dechex($id)."\n";
|
||||
$parents = hw_getparentsobj($connect, $collid);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
$c_parents = count($parents) - 1;
|
||||
for($i=0; $i<$c_parents; $i++) {
|
||||
$objarr = hw_objrec2array($parents[$i]);
|
||||
list_attr($objarr);
|
||||
}
|
||||
list_attr($parents[$c_parents]);
|
||||
}
|
||||
|
||||
if($test_7 == "yes") {
|
||||
echo "TEST 7 ----------------------------------------------\n";
|
||||
echo "Inserting a new text document into 0x".dechex($collid)."\n";
|
||||
$objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username;
|
||||
$contents = "Ein bischen Text";
|
||||
$doc = hw_new_document($objrec, $contents, strlen($contents)+1);
|
||||
$objid = hw_insertdocument($connect, $collid, $doc);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
$objrec = hw_getobject($connect, $objid);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
$objarr = hw_objrec2array($objrec);
|
||||
list_attr($objarr);
|
||||
}
|
||||
|
||||
if($test_8 == "yes") {
|
||||
echo "TEST 8 ----------------------------------------------\n";
|
||||
echo "Removing text document just inserted\n";
|
||||
$kk[0] = (int) $objid;
|
||||
hw_mv($connect, $kk, $collid, 0);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
exit;
|
||||
}
|
||||
echo "If the document was really deleted you should see an error now\n";
|
||||
$objrec = hw_getobject($connect, $objid);
|
||||
if(hw_error($connect)) {
|
||||
echo "ERROR: ".hw_errormsg($connect)."\n";
|
||||
} else {
|
||||
$objarr = hw_objrec2array($objrec);
|
||||
list_attr($objarr);
|
||||
}
|
||||
}
|
||||
|
||||
if($test_9 == "yes") {
|
||||
echo "TEST 9 ----------------------------------------------\n";
|
||||
echo "Searching for objects with $query\n";
|
||||
$objrecs = hw_getobjectbyqueryobj($connect, $query, -1);
|
||||
$c_objrecs = count($objrecs) - 1;
|
||||
echo "$c_objrecs found\n";
|
||||
for($i=0; $i<$c_objrecs; $i++) {
|
||||
$objarr = hw_objrec2array($objrecs[$i]);
|
||||
list_attr($objarr);
|
||||
}
|
||||
list_attr($objrecs[$c_objrecs]);
|
||||
}
|
||||
|
||||
if($test_10 == "yes") {
|
||||
$anchors = hw_getanchorsobj($connect, $id);
|
||||
$countanchors = count($anchors) - 1;
|
||||
echo "$countanchors Anchors of Object $id\n";
|
||||
for($i=0; $i<$countanchors; $i++) {
|
||||
$arr = hw_objrec2array($anchors[$i]);
|
||||
list_attr($arr);
|
||||
}
|
||||
}
|
||||
|
||||
if($test_11 == "yes") {
|
||||
$doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
|
||||
hw_output_document($doc);
|
||||
}
|
||||
|
||||
if($test_12 == "yes") {
|
||||
$doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
|
||||
hw_insertanchors($doc, array("Position=0x2 0x7\nObjectID=0x3\nTAnchor=Src\nDest=0x5"), array("ObjectID=0x5\nName=DestDoc"));
|
||||
hw_output_document($doc);
|
||||
}
|
||||
|
||||
hw_close($connect);
|
||||
?>
|
@ -1,5 +0,0 @@
|
||||
<?
|
||||
print "Before include....\n";
|
||||
$retval = include("testarray");
|
||||
print "After include, include returned $retval\n";
|
||||
?>
|
@ -1,29 +0,0 @@
|
||||
<?
|
||||
define("endl","\n");
|
||||
|
||||
class foobar {
|
||||
function foobar() {
|
||||
$this->initialized = 1;
|
||||
}
|
||||
};
|
||||
|
||||
class barbara extends foobar {
|
||||
|
||||
};
|
||||
|
||||
$name = "foobar";
|
||||
$foo = new $name; // or die("Unable to construct foobar\n");
|
||||
//print $foo->initialized;
|
||||
|
||||
$boo = new barbara;
|
||||
print get_class($foo).endl;
|
||||
print get_parent_class($foo).endl;
|
||||
print get_class($boo).endl;
|
||||
print get_parent_class($boo).endl;
|
||||
print method_exists($foo,"foobar").endl;
|
||||
print method_exists($boo,"foobar").endl;
|
||||
print method_exists($boo,"barbara").endl;
|
||||
//$word = new COm("word.application");
|
||||
//$word->visible = true;
|
||||
//sleep(5);
|
||||
//$word->quit();
|
@ -1,39 +0,0 @@
|
||||
<?
|
||||
|
||||
if (!extension_loaded('pfpro')) {
|
||||
die("pfpro module is not compiled in PHP\n");
|
||||
}
|
||||
|
||||
echo "<pre>\n\n";
|
||||
|
||||
echo "Payflow Pro library is version ".pfpro_version()."\n";
|
||||
|
||||
pfpro_init();
|
||||
|
||||
$transaction = array(USER => 'mylogin',
|
||||
PWD => 'mypassword',
|
||||
TRXTYPE => 'S',
|
||||
TENDER => 'C',
|
||||
AMT => 1.50,
|
||||
ACCT => '4111111111111111',
|
||||
EXPDATE => '0900'
|
||||
);
|
||||
|
||||
$response = pfpro_process($transaction);
|
||||
|
||||
if (!$response) {
|
||||
die("Couldn't establish link to signio software.\n");
|
||||
}
|
||||
|
||||
echo "Signio response code was ".$response[RESULT];
|
||||
echo ", which means: ".$response[RESPMSG]."\n";
|
||||
|
||||
echo "\nDump of the transaction request ";
|
||||
print_r($transaction);
|
||||
|
||||
echo "\nDump of the response ";
|
||||
print_r($response);
|
||||
|
||||
pfpro_cleanup();
|
||||
|
||||
?>
|
@ -1,61 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="tests" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) External Target" 0x0106
|
||||
|
||||
CFG=tests - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tests.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tests.mak" CFG="tests - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "tests - Win32 Debug" (based on "Win32 (x86) External Target")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "."
|
||||
# PROP BASE Intermediate_Dir "."
|
||||
# PROP BASE Cmd_Line "NMAKE /f tests.mak"
|
||||
# PROP BASE Rebuild_Opt "/a"
|
||||
# PROP BASE Target_File "tests.exe"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "."
|
||||
# PROP Intermediate_Dir "."
|
||||
# PROP Cmd_Line "nmake /nologo /f tests.mak"
|
||||
# PROP Rebuild_Opt "/a"
|
||||
# PROP Target_File "__test_run_complete__"
|
||||
# PROP Bsc_Name ""
|
||||
# PROP Target_Dir ""
|
||||
# Begin Target
|
||||
|
||||
# Name "tests - Win32 Debug"
|
||||
|
||||
!IF "$(CFG)" == "tests - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\run-tests.php"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tests.mak
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
@ -1,27 +0,0 @@
|
||||
#
|
||||
# Win32 Makefile to run the PHP unit tests.
|
||||
#
|
||||
# TEST_PHP_EXECUTABLE
|
||||
# Required - must point to the PHP executable to test.
|
||||
#
|
||||
# TEST_PHP_ERROR_STYLE
|
||||
# Optional - specifies error format to output so IDE can jump to test source and log.
|
||||
# Values: MSVC (Microsoft Visual C++), Emacs
|
||||
#
|
||||
# TEST_PHP_DETAILED
|
||||
# Optional - generates a more complete and detailed log if set.
|
||||
# Values: 0 or unset - no details; 1 - detailed.
|
||||
#
|
||||
|
||||
all : run-tests
|
||||
|
||||
BIN=Debug_TS
|
||||
|
||||
# Specific test(s) to run (all if not specified).
|
||||
TESTS=
|
||||
|
||||
run-tests :
|
||||
set TEST_PHP_EXECUTABLE=$(BIN)\php-cgi.exe
|
||||
set TEST_PHP_ERROR_STYLE=MSVC
|
||||
set TEST_PHP_DETAILED=0
|
||||
cd .. && $(BIN)\php-cgi.exe -c tests -f run-tests.php $(TESTS) | tee tests.log
|
@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
function print_value($val,$postfix="<br>") {
|
||||
if (is_array($val)) {
|
||||
for ($i = 0;$i< count($val);$i++) {
|
||||
echo $val[$i] . $postfix;
|
||||
}
|
||||
} else {
|
||||
echo $val . $postfix;
|
||||
}
|
||||
}
|
||||
|
||||
function do_sscanf($string, $format) {
|
||||
$s = "sscanf(\"" . $string . ",\"" . $format ."\").";
|
||||
echo "$s<br>";
|
||||
$s = str_repeat("-", strlen($s));
|
||||
echo "$s<br>";
|
||||
$output = sscanf($string,$format);
|
||||
echo "Result : ";
|
||||
print_value( $output );
|
||||
echo "$s<br><br>";
|
||||
}
|
||||
|
||||
|
||||
function run_sscanf_test_cases($filename="scan_cases")
|
||||
{
|
||||
|
||||
echo "<h3><em><br>Running Test Cases from $filename<br></em></h3>";
|
||||
$arr = file($filename);
|
||||
for ($i=0;$i < count($arr);$i++) {
|
||||
$line_arr = explode("|",$arr[$i]);
|
||||
|
||||
$format = $line_arr[0];
|
||||
$string = $line_arr[1];
|
||||
if (count($arr) > 2) {
|
||||
$comment = $line_arr[2];
|
||||
} else {
|
||||
$comment = "";
|
||||
}
|
||||
if ( empty($format) || empty($string) ) {
|
||||
continue;
|
||||
}
|
||||
print("<h4>** Case : $comment ******************************</h4>");
|
||||
do_sscanf($string,$format);
|
||||
}
|
||||
}
|
||||
|
||||
function simple_tests() {
|
||||
echo "Testing sscanf with standard ANSI syntax (values returned by
|
||||
reference)-<br>";
|
||||
$decimal = -1;
|
||||
$string = "";
|
||||
$hex = 0;
|
||||
$float = 0.0;
|
||||
$octal = 0.0;
|
||||
$int = -1;
|
||||
|
||||
echo "<h3><em><br>Simple Test<br></em></h3>";
|
||||
echo "sscanf('10','%d',&\$decimal) <br>";
|
||||
echo "<br>BEFORE : <br> decimal = $decimal.";
|
||||
$foo = sscanf("10","%d",&$decimal);
|
||||
echo "<br>AFTER : <br> decimal = $decimal <br>";
|
||||
|
||||
|
||||
echo "<h3><em><br>Simple Test 2<br></em></h3>";
|
||||
echo "sscanf(\"ghost 0xface\",\"%s %x\",&\$string, &\$int)<br>";
|
||||
echo "<br>BEFORE : <br> string = $string, int = $int<br>";
|
||||
$foo = sscanf("ghost 0xface","%s %x",&$string, &$int);
|
||||
echo "<br>AFTER : <br> string = $string, int = $int<br>";
|
||||
echo " sscan reports : ";
|
||||
print_value( $foo,"");
|
||||
echo " conversions <br>";
|
||||
|
||||
echo "<h3><em><br>Multiple specifiers<br></em></h3>";
|
||||
echo "sscanf(\"jabberwocky 1024 0xFF 1.024 644 10\",
|
||||
\"%s %d %x %f %o %i\",
|
||||
&\$string,&\$decimal,&\$hex,&\$float,&\$octal,&\$int);<br>";
|
||||
echo "<br>BEFORE : <br>";
|
||||
echo "Decimal = $decimal, String = $string, Hex = $hex<br>";
|
||||
echo "Octal = $octal , Float = $float, Int = $int<br>";
|
||||
$foo = sscanf( "jabberwocky 1024 0xFF 1.024 644 10",
|
||||
"%s %d %x %f %o %i",
|
||||
&$string,&$decimal,&$hex,&$float,&$octal,&$int);
|
||||
echo "<br>AFTER :<br>";
|
||||
echo "decimal = $decimal, string = $string, hex = $hex<br>";
|
||||
echo "octal = $octal , float = $float, int = $int<br>";
|
||||
|
||||
echo " sscan reports : ";
|
||||
print_value( $foo,"");
|
||||
echo " conversions <br>";
|
||||
echo "----------------------------------------<br>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test of sscanf()</title>
|
||||
</head>
|
||||
<body>
|
||||
<strong><h1>Testing sscanf() support in PHP</h1></strong><br>
|
||||
<?php
|
||||
if (!function_exists('sscanf')) {
|
||||
echo "<strong>I'm sorry but sscanf() does not exist !i</strong><br>";
|
||||
} else {
|
||||
simple_tests();
|
||||
run_sscanf_test_cases();
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
120
tests/testswf
120
tests/testswf
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
|
||||
$LINEID=1;
|
||||
$LINEDEPTH=50;
|
||||
$LINESTEPS=30;
|
||||
|
||||
$CIRCLEID=2;
|
||||
$CIRCLEDEPT=100;
|
||||
|
||||
/* stop playing */
|
||||
function stop()
|
||||
{
|
||||
swf_startdoaction();
|
||||
swf_actionStop();
|
||||
swf_enddoaction();
|
||||
}
|
||||
|
||||
/* play stoping */
|
||||
function play()
|
||||
{
|
||||
swf_startdoaction();
|
||||
swf_actionPlay();
|
||||
swf_enddoaction();
|
||||
}
|
||||
|
||||
/*
|
||||
* demonstrates:
|
||||
* defining and placing an object.
|
||||
*
|
||||
*/
|
||||
function flipline()
|
||||
{
|
||||
global $LINESTEPS, $LINEID, $LINEDEPTH;
|
||||
|
||||
swf_ortho2(-100.0,100.0,-100.0,100.0);
|
||||
swf_defineline($LINEID,-60.0,0.0,60.0,0.0,1.2);
|
||||
swf_mulcolor(1.0,1.0,1.0,1.0);
|
||||
swf_addcolor(0.0,0.0,0.0,0.0);
|
||||
for($i=0; $i<$LINESTEPS; $i++) {
|
||||
$p = $i/($LINESTEPS-1.0);
|
||||
swf_pushmatrix();
|
||||
swf_rotate(60.0*$p,'z');
|
||||
swf_translate(20.0+20.0*$p,0.0,0.0);
|
||||
swf_rotate(120.0*$p,'z');
|
||||
swf_placeobject($LINEID, $LINEDEPTH);
|
||||
swf_popmatrix();
|
||||
swf_showframe();
|
||||
}
|
||||
for($i=0; $i<$LINESTEPS; $i++) {
|
||||
swf_removeobject($LINEDEPTH);
|
||||
if(($i%4) == 0)
|
||||
swf_showframe();
|
||||
}
|
||||
swf_showframe();
|
||||
}
|
||||
|
||||
/* growblobs follows */
|
||||
|
||||
$NBLOBS=8;
|
||||
$BLOBSTEPS=20;
|
||||
|
||||
/*
|
||||
* demonstrates:
|
||||
* shape definition
|
||||
* placing, and modifying objects.
|
||||
*
|
||||
*/
|
||||
function growblobs()
|
||||
{
|
||||
global $NBLOBS, $BLOBSTEPS, $CIRCLEDEPT, $CIRCLEID;
|
||||
|
||||
swf_ortho2(-200.0,200.0,-200.0,200.0);
|
||||
|
||||
swf_startshape($CIRCLEID);
|
||||
swf_shapefillsolid(0.0,0.0,0.0,1.0);
|
||||
swf_shapearc(0.0,0.0,300.0,0.0,360.0);
|
||||
swf_endshape();
|
||||
|
||||
swf_mulcolor(1.0,1.0,1.0,1.0);
|
||||
$startframe = swf_getframe();
|
||||
for($j=0; $j<$NBLOBS; $j++) {
|
||||
swf_setframe($startframe+2*$j);
|
||||
for($i=0; $i<$BLOBSTEPS; $i++) {
|
||||
$p = $i/($BLOBSTEPS-1.0);
|
||||
swf_pushmatrix();
|
||||
swf_scale($p,$p,$p);
|
||||
swf_addcolor($p,$p,$p,0.0);
|
||||
if($i== 0)
|
||||
swf_placeobject($CIRCLEID,$CIRCLEDEPTH+$j);
|
||||
else
|
||||
swf_modifyobject($CIRCLEDEPTH+$j,MOD_COLOR|MOD_MATRIX);
|
||||
swf_popmatrix();
|
||||
swf_showframe();
|
||||
}
|
||||
swf_removeobject($CIRCLEDEPTH+$j);
|
||||
}
|
||||
swf_showframe();
|
||||
}
|
||||
|
||||
swf_openfile("test.swf",400.0,400.0,20.0,1.0,1.0,1.0);
|
||||
flipline();
|
||||
growblobs();
|
||||
|
||||
// trytext();
|
||||
// makebuttons();
|
||||
// stop();
|
||||
swf_showframe();
|
||||
swf_closefile();
|
||||
|
||||
// swf_openfile("images.swf",400.0,400.0,20.0,1.0,1.0,1.0);
|
||||
// showimages();
|
||||
// brushstrokes();
|
||||
// symboltest();
|
||||
// stop();
|
||||
// swf_showframe();
|
||||
// swf_closefile();
|
||||
// fprintf(stderr,"wrote images.swf\n");
|
||||
exit(0);
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user