xref: /PHP-8.3/ext/spl/tests/heap_006.phpt (revision a555cc0b)
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--EXPECT--
1999 => 100
2098 => 99
2197 => 98
2296 => 97
2395 => 96
2494 => 95
2593 => 94
2692 => 93
2791 => 92
2890 => 91
2989 => 90
3088 => 89
3187 => 88
3286 => 87
3385 => 86
3484 => 85
3583 => 84
3682 => 83
3781 => 82
3880 => 81
3979 => 80
4078 => 79
4177 => 78
4276 => 77
4375 => 76
4474 => 75
4573 => 74
4672 => 73
4771 => 72
4870 => 71
4969 => 70
5068 => 69
5167 => 68
5266 => 67
5365 => 66
5464 => 65
5563 => 64
5662 => 63
5761 => 62
5860 => 61
5959 => 60
6058 => 59
6157 => 58
6256 => 57
6355 => 56
6454 => 55
6553 => 54
6652 => 53
6751 => 52
6850 => 51
6949 => 50
7048 => 49
7147 => 48
7246 => 47
7345 => 46
7444 => 45
7543 => 44
7642 => 43
7741 => 42
7840 => 41
7939 => 40
8038 => 39
8137 => 38
8236 => 37
8335 => 36
8434 => 35
8533 => 34
8632 => 33
8731 => 32
8830 => 31
8929 => 30
9028 => 29
9127 => 28
9226 => 27
9325 => 26
9424 => 25
9523 => 24
9622 => 23
9721 => 22
9820 => 21
9919 => 20
10018 => 19
10117 => 18
10216 => 17
10315 => 16
10414 => 15
10513 => 14
10612 => 13
10711 => 12
10810 => 11
1099 => 10
1108 => 9
1117 => 8
1126 => 7
1135 => 6
1144 => 5
1153 => 4
1162 => 3
1171 => 2
1180 => 1
119