File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
dllist_005.phpt
Revision
1.1.1.2 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:43 2012 UTC (12 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
SPL: DoublyLinkedList: Queues
--FILE--
<?php
$queue = new SplQueue();
// errors
try {
$queue->dequeue();
} catch (RuntimeException $e) {
echo "Exception: ".$e->getMessage()."\n";
}
try {
$queue->shift();
} catch (RuntimeException $e) {
echo "Exception: ".$e->getMessage()."\n";
}
// data consistency
$a = 2;
$queue->enqueue($a);
echo $queue->dequeue()."\n";
// peakable
$queue->enqueue(1);
$queue->enqueue(2);
echo $queue->top()."\n";
// iterable
foreach ($queue as $elem) {
echo "[$elem]\n";
}
// countable
$queue->enqueue(NULL);
$queue->enqueue(NULL);
echo count($queue)."\n";
echo $queue->count()."\n";
var_dump($queue->dequeue());
var_dump($queue->dequeue());
// clonable
$queue->enqueue(2);
$queue_clone = clone $queue;
$queue_clone->dequeue();
echo count($queue)."\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Exception: Can't shift from an empty datastructure
Exception: Can't shift from an empty datastructure
2
2
[1]
[2]
4
4
int(1)
int(2)
3
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>