| @@ 16-33 (lines=18) @@ | ||
| 13 | class BoxListTest extends TestCase |
|
| 14 | { |
|
| 15 | ||
| 16 | function testCompare() |
|
| 17 | { |
|
| 18 | ||
| 19 | $box1 = new TestBox('Small', 21, 21, 3, 1, 20, 20, 2, 100); |
|
| 20 | $box2 = new TestBox('Large', 201, 201, 21, 1, 200, 200, 20, 1000); |
|
| 21 | $box3 = new TestBox('Medium', 101, 101, 11, 5, 100, 100, 10, 500); |
|
| 22 | ||
| 23 | $list = new BoxList; |
|
| 24 | $list->insert($box1); |
|
| 25 | $list->insert($box2); |
|
| 26 | $list->insert($box3); |
|
| 27 | ||
| 28 | $sorted = []; |
|
| 29 | while (!$list->isEmpty()) { |
|
| 30 | $sorted[] = $list->extract(); |
|
| 31 | } |
|
| 32 | self::assertEquals(array($box1, $box3, $box2), $sorted); |
|
| 33 | } |
|
| 34 | ||
| 35 | function testIssue14A() |
|
| 36 | { |
|
| @@ 35-49 (lines=15) @@ | ||
| 32 | self::assertEquals(array($box1, $box3, $box2), $sorted); |
|
| 33 | } |
|
| 34 | ||
| 35 | function testIssue14A() |
|
| 36 | { |
|
| 37 | $box1 = new TestBox('Small', 21, 21, 3, 1, 20, 20, 2, 100); |
|
| 38 | $box2 = new TestBox('Large', 1301, 1301, 1301, 1, 1300, 1300, 1300, 1000); |
|
| 39 | $box3 = new TestBox('Medium', 101, 101, 11, 5, 100, 100, 10, 500); |
|
| 40 | $list = new BoxList; |
|
| 41 | $list->insert($box1); |
|
| 42 | $list->insert($box2); |
|
| 43 | $list->insert($box3); |
|
| 44 | $sorted = []; |
|
| 45 | while (!$list->isEmpty()) { |
|
| 46 | $sorted[] = $list->extract(); |
|
| 47 | } |
|
| 48 | self::assertEquals(array($box1, $box3, $box2), $sorted); |
|
| 49 | } |
|
| 50 | ||
| 51 | function testIssue14B() |
|
| 52 | { |
|