Annotation of embedaddon/php/ext/spl/tests/spl_pq_top_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: SplPriorityQueue: top and extract flags
3: --CREDITS--
4: Nathaniel McHugh nat@fishtrap.co.uk
5: #testfest London 2009-05-09
6: --FILE--
7: <?php
8:
9: $priorityQueue = new SplPriorityQueue();
10:
11: $priorityQueue->insert("a", 1);
12: $priorityQueue->insert("b", 2);
13: $priorityQueue->insert("c", 0);
14:
15: echo "EXTR DEFAULT",PHP_EOL;
16: echo "value: ",$priorityQueue->top(),PHP_EOL;
17:
18: $priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
19: echo "EXTR_PRIORITY",PHP_EOL;
20: echo "priority: ",$priorityQueue->top(),PHP_EOL;
21:
22: $priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH);
23: echo "EXTR_BOTH",PHP_EOL;
24: print_r($priorityQueue->top());
25:
26: echo "EXTR_DATA",PHP_EOL;
27: $priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA);
28: echo "value: ",$priorityQueue->top(),PHP_EOL;
29: ?>
30: --EXPECT--
31: EXTR DEFAULT
32: value: b
33: EXTR_PRIORITY
34: priority: 2
35: EXTR_BOTH
36: Array
37: (
38: [data] => b
39: [priority] => 2
40: )
41: EXTR_DATA
42: value: b
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>