1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 04:51:03 +02:00
Files
archived-php-src/ext/spl/tests/heap_003.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

45 lines
534 B
PHP

--TEST--
SPL: SplHeap: comparison callback
--FILE--
<?php
class myHeap extends SplHeap {
public function compare($a, $b) {
if ($a > $b) {
$result = 1;
} else if ($a < $b) {
$result = -1;
} else {
$result = 0;
}
return $result;
}
}
$h = new myHeap;
$in = range(0,10);
shuffle($in);
foreach ($in as $i) {
$h->insert($i);
}
foreach ($h as $out) {
echo $out."\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
10
9
8
7
6
5
4
3
2
1
0
===DONE===