tony2001 Sat Jun 7 14:10:22 2008 UTC
Added files:
/php-src/ext/spl/tests fastarray_005.phpt fastarray_006.phpt
fastarray_007.phpt fastarray_008.phpt
fastarray_009.phpt fastarray_010.phpt
fastarray_011.phpt fastarray_012.phpt
fastarray_013.phpt fastarray_014.phpt
Modified files:
/php-src/ext/spl/tests fastarray_004.phpt
Log:
more tests (by Felipe)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_004.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/spl/tests/fastarray_004.phpt
diff -u /dev/null php-src/ext/spl/tests/fastarray_004.phpt:1.2
--- /dev/null Sat Jun 7 14:10:21 2008
+++ php-src/ext/spl/tests/fastarray_004.phpt Sat Jun 7 14:10:21 2008
@@ -0,0 +1,16 @@
+--TEST--
+SPL: FastArray: adding new elements
+--FILE--
+<?php
+
+$a = new SplFastArray(10);
+
+try {
+ $a[] = 1;
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+===DONE===
+--EXPECTF--
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_005.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_005.phpt
+++ php-src/ext/spl/tests/fastarray_005.phpt
--TEST--
SPL: FastArray: Trying to instantiate passing object to constructor parameter
--FILE--
<?php
$b = new stdClass;
$a = new SplFastArray($b);
?>
--EXPECTF--
Warning: SplFastArray::__construct() expects parameter 1 to be long, object
given in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_006.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_006.phpt
+++ php-src/ext/spl/tests/fastarray_006.phpt
--TEST--
SPL: FastArray: Assigning objects
--FILE--
<?php
$b = 10000;
$a = new SplFastArray($b);
try {
for ($i = 0; $i < 100; $i++) {
$a[] = new stdClass;
}
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
print "ok\n";
?>
--EXPECT--
Index invalid or out of range
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_007.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_007.phpt
+++ php-src/ext/spl/tests/fastarray_007.phpt
--TEST--
SPL: FastArray: Assigning the itself object
--FILE--
<?php
$b = 10;
$a = new SplFastArray($b);
try {
$a[1] = $a;
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
foreach ($a as $c) {
if ($c) {
echo $c->getSize(), "\n";
}
}
print "ok\n";
?>
--EXPECT--
10
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_008.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_008.phpt
+++ php-src/ext/spl/tests/fastarray_008.phpt
--TEST--
SPL: FastArray: Assigning the itself object testing the reference
--FILE--
<?php
$b = 3;
$a = new SplFastArray($b);
$a[0] = 1;
$a[1] = 2;
$a[2] = $a;
$a[2][0] = 3;
foreach ($a as $x) {
if (is_object($x)) {
var_dump($x[0]);
} else {
var_dump($x);
}
}
var_dump($a->getSize());
?>
--EXPECT--
int(3)
int(2)
int(3)
int(3)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_009.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_009.phpt
+++ php-src/ext/spl/tests/fastarray_009.phpt
--TEST--
SPL: FastArray: Trying to instantiate passing string to construtor parameter
--FILE--
<?php
$a = new SplFastArray('FOO');
?>
--EXPECTF--
Warning: SplFastArray::__construct() expects parameter 1 to be long, string
given in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_010.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_010.phpt
+++ php-src/ext/spl/tests/fastarray_010.phpt
--TEST--
SPL: FastArray: Setting size to 0
--FILE--
<?php
$a = new SplFastArray(1);
$a[0] = 1;
$a->setSize(0);
print "ok\n";
?>
--EXPECT--
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_011.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_011.phpt
+++ php-src/ext/spl/tests/fastarray_011.phpt
--TEST--
SPL: FastArray: Testing setSize() with NULL
--FILE--
<?php
$a = new SplFastArray(100);
$a->setSize(NULL);
print "ok\n";
?>
--EXPECT--
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_012.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_012.phpt
+++ php-src/ext/spl/tests/fastarray_012.phpt
--TEST--
SPL: FastArray: Assigning the object to another variable using []
--FILE--
<?php
$a = new SplFastArray(100);
try {
$b = &$a[];
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
print "ok\n";
?>
--EXPECT--
Index invalid or out of range
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_013.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_013.phpt
+++ php-src/ext/spl/tests/fastarray_013.phpt
--TEST--
SPL: FastArray: Passing the object using [] as parameter
--FILE--
<?php
$a = new SplFastArray(100);
function test(SplFastArray &$arr) {
print "ok\n";
}
try {
test($a[]);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Index invalid or out of range
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fastarray_014.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/fastarray_014.phpt
+++ php-src/ext/spl/tests/fastarray_014.phpt
--TEST--
SPL: FastArray: Trying to access inexistent item
--FILE--
<?php
try {
$a = new SplFastArray(NULL);
echo $a[0]++;
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Index invalid or out of range
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php