Annotation of embedaddon/php/ext/spl/tests/dllist_003.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: DoublyLinkedList: iterator modes
3: --FILE--
4: <?php
5: $dll = new SplDoublyLinkedList();
6: $dll->push(2);
7: $dll->push(3);
8: $dll->push(4);
9:
10: $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
11:
12: foreach ($dll as $k => $v) {
13: echo "$k=>$v\n";
14: }
15:
16: $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
17: foreach ($dll as $k => $v) {
18: echo "$k=>$v\n";
19: }
20:
21: $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
22: var_dump($dll->count());
23: foreach ($dll as $k => $v) {
24: echo "$k=>$v\n";
25: }
26: var_dump($dll->count());
27:
28: ?>
29: ===DONE===
30: <?php exit(0); ?>
31: --EXPECTF--
32: 2=>4
33: 1=>3
34: 0=>2
35: 0=>2
36: 1=>3
37: 2=>4
38: int(3)
39: 0=>2
40: 0=>3
41: 0=>4
42: int(0)
43: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>