Annotation of embedaddon/php/ext/spl/tests/heap_001.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SPL: SplMaxHeap: std operations
                      3: --FILE--
                      4: <?php
                      5: $h = new SplMaxHeap();
                      6: 
                      7: // errors
                      8: try {
                      9:     $h->extract();
                     10: } catch (RuntimeException $e) {
                     11:     echo "Exception: ".$e->getMessage()."\n";
                     12: }
                     13: 
                     14: 
                     15: $h->insert(1);
                     16: $h->insert(2);
                     17: $h->insert(3);
                     18: $h->insert(3);
                     19: $h->insert(3);
                     20: 
                     21: echo $h->count()."\n";
                     22: echo $h->extract()."\n";
                     23: echo $h->extract()."\n";
                     24: echo $h->extract()."\n";
                     25: echo $h->extract()."\n";
                     26: echo $h->extract()."\n";
                     27: echo $h->count()."\n";
                     28: 
                     29: echo "--\n";
                     30: 
                     31: $b = 4;
                     32: $h->insert($b);
                     33: $b = 5;
                     34: 
                     35: $h2 = clone $h;
                     36: echo $h->extract()."\n";
                     37: echo $h2->extract()."\n";
                     38: ?>
                     39: ===DONE===
                     40: <?php exit(0); ?>
                     41: --EXPECTF--
                     42: Exception: Can't extract from an empty heap
                     43: 5
                     44: 3
                     45: 3
                     46: 3
                     47: 2
                     48: 1
                     49: 0
                     50: --
                     51: 4
                     52: 4
                     53: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>