cvs: php-src /ext/spl/tests array_014.phpt array_016.phpt
| From: | Marcus Boerger | Date: | Thu, 03 Mar 2005 10:48:03 +0000 |
| Subject: | cvs: php-src /ext/spl/tests array_014.phpt array_016.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-30706@lists.php.net to get a copy of this message | ||
helly Thu Mar 3 05:48:03 2005 EDT
Added files:
/php-src/ext/spl/tests array_016.phpt
Modified files:
/php-src/ext/spl/tests array_014.phpt
Log:
- Rename test 14 to 16 (which is a new one) and MFB 14 again
http://cvs.php.net/diff.php/php-src/ext/spl/tests/array_014.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/spl/tests/array_014.phpt
diff -u php-src/ext/spl/tests/array_014.phpt:1.3 php-src/ext/spl/tests/array_014.phpt:1.4
--- php-src/ext/spl/tests/array_014.phpt:1.3 Sun Oct 31 13:43:00 2004
+++ php-src/ext/spl/tests/array_014.phpt Thu Mar 3 05:48:02 2005
@@ -1,21 +1,32 @@
--TEST--
-SPL: ArrayItaerator/Object and IteratorIterator
+SPL: ArrayIterator::seek()
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
-$it = new ArrayIterator(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
+$it = new ArrayIterator(range(0,10));
+var_dump($it->count());
+$it->seek(5);
+var_dump($it->current());
+$it->seek(4);
+var_dump($it->current());
+$it->seek(-1);
+var_dump($it->current());
+try
{
- var_dump($v);
+ $it->seek(12);
+ var_dump($it->current());
+}
+catch(Exception $e)
+{
+ echo $e->getMessage() . "\n";
}
-$it = new ArrayObject(range(0,3));
-
-foreach(new IteratorIterator($it) as $v)
+$pos = 0;
+foreach($it as $v)
{
+ $it->seek($pos++);
var_dump($v);
}
@@ -23,12 +34,20 @@
===DONE===
<?php exit(0); ?>
--EXPECTF--
+int(11)
+int(5)
+int(4)
int(0)
-int(1)
-int(2)
-int(3)
+Seek position 12 is out of range
int(0)
int(1)
int(2)
int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
===DONE===
http://cvs.php.net/co.php/php-src/ext/spl/tests/array_016.phpt?r=1.1&p=1
Index: php-src/ext/spl/tests/array_016.phpt
+++ php-src/ext/spl/tests/array_016.phpt
--TEST--
SPL: ArrayItaerator/Object and IteratorIterator
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
$it = new ArrayIterator(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
$it = new ArrayObject(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
int(0)
int(1)
int(2)
int(3)
int(0)
int(1)
int(2)
int(3)
===DONE===