xref: /PHP-7.4/ext/spl/tests/heap_006.phpt (revision ded3d984)
1--TEST--
2SPL: SplMaxHeap: large unordered input iterated
3--FILE--
4<?php
5$input = range(1,100);
6shuffle($input);
7
8$h = new SplMaxHeap();
9
10foreach($input as $i) {
11    $h->insert($i);
12}
13
14foreach ($h as $k => $o) {
15    echo "$k => $o\n";
16}
17?>
18===DONE===
19<?php exit(0); ?>
20--EXPECT--
2199 => 100
2298 => 99
2397 => 98
2496 => 97
2595 => 96
2694 => 95
2793 => 94
2892 => 93
2991 => 92
3090 => 91
3189 => 90
3288 => 89
3387 => 88
3486 => 87
3585 => 86
3684 => 85
3783 => 84
3882 => 83
3981 => 82
4080 => 81
4179 => 80
4278 => 79
4377 => 78
4476 => 77
4575 => 76
4674 => 75
4773 => 74
4872 => 73
4971 => 72
5070 => 71
5169 => 70
5268 => 69
5367 => 68
5466 => 67
5565 => 66
5664 => 65
5763 => 64
5862 => 63
5961 => 62
6060 => 61
6159 => 60
6258 => 59
6357 => 58
6456 => 57
6555 => 56
6654 => 55
6753 => 54
6852 => 53
6951 => 52
7050 => 51
7149 => 50
7248 => 49
7347 => 48
7446 => 47
7545 => 46
7644 => 45
7743 => 44
7842 => 43
7941 => 42
8040 => 41
8139 => 40
8238 => 39
8337 => 38
8436 => 37
8535 => 36
8634 => 35
8733 => 34
8832 => 33
8931 => 32
9030 => 31
9129 => 30
9228 => 29
9327 => 28
9426 => 27
9525 => 26
9624 => 25
9723 => 24
9822 => 23
9921 => 22
10020 => 21
10119 => 20
10218 => 19
10317 => 18
10416 => 17
10515 => 16
10614 => 15
10713 => 14
10812 => 13
10911 => 12
11010 => 11
1119 => 10
1128 => 9
1137 => 8
1146 => 7
1155 => 6
1164 => 5
1173 => 4
1182 => 3
1191 => 2
1200 => 1
121===DONE===
122