mirror of
https://github.com/php/php-src.git
synced 2024-11-26 03:16:33 +08:00
51 lines
635 B
PHP
51 lines
635 B
PHP
--TEST--
|
|
SPL: SplMinHeap: std operations
|
|
--FILE--
|
|
<?php
|
|
$h = new SplMinHeap();
|
|
|
|
// errors
|
|
try {
|
|
$h->extract();
|
|
} catch (RuntimeException $e) {
|
|
echo "Exception: ".$e->getMessage()."\n";
|
|
}
|
|
|
|
|
|
$h->insert(1);
|
|
$h->insert(2);
|
|
$h->insert(3);
|
|
$h->insert(3);
|
|
$h->insert(3);
|
|
|
|
echo $h->count()."\n";
|
|
echo $h->extract()."\n";
|
|
echo $h->extract()."\n";
|
|
echo $h->extract()."\n";
|
|
echo $h->extract()."\n";
|
|
echo $h->extract()."\n";
|
|
echo $h->count()."\n";
|
|
|
|
echo "--\n";
|
|
|
|
$b = 4;
|
|
$h->insert($b);
|
|
$b = 5;
|
|
|
|
echo $h->extract()."\n";
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
Exception: Can't extract from an empty heap
|
|
5
|
|
1
|
|
2
|
|
3
|
|
3
|
|
3
|
|
0
|
|
--
|
|
4
|
|
===DONE===
|