Skip to content

Commit

Permalink
fix 74
Browse files Browse the repository at this point in the history
; Conflicts:
;	tests/PackerTest.php
  • Loading branch information
dvdoug committed Jul 26, 2023
1 parent a495df5 commit 2a29a27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
20 changes: 9 additions & 11 deletions tests/PublishedTestCasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public static function setUpBeforeClass(): void
*/
public function testLohAndNee($problem, $box, $items): void
{
$this->runPublishedTestcase($problem, $box, $items);
self::runPublishedTestcase($problem, $box, $items);
}

public function lohAndNeeData(): array
public static function lohAndNeeData(): array
{
$data = [];
$fileData = $this->thpackDecode('thpack8.txt');
$fileData = self::thpackDecode('thpack8.txt');
foreach ($fileData as &$problem) {
$problem[0] = "Loh and Nee #{$problem[0]}";
$data[$problem[0]] = $problem;
Expand All @@ -88,15 +88,15 @@ public function lohAndNeeData(): array
*/
public function testBischoff($problem, $box, $items): void
{
$this->runPublishedTestcase($problem, $box, $items);
self::runPublishedTestcase($problem, $box, $items);
}

public function bischoffData(): array
public static function bischoffData(): array
{
$data = [];

for ($i = 1; $i <= 7; ++$i) {
$fileData = $this->thpackDecode("thpack{$i}.txt");
$fileData = self::thpackDecode("thpack{$i}.txt");
foreach ($fileData as &$problem) {
$problem[0] = "Bischoff #{$problem[3]}-{$problem[0]}";
$data[$problem[0]] = $problem;
Expand All @@ -106,7 +106,7 @@ public function bischoffData(): array
return $data;
}

public function runPublishedTestcase($problem, Box $box, ItemList $items): void
public static function runPublishedTestcase($problem, Box $box, ItemList $items): void
{
$packer = new VolumePacker($box, $items);
$packedBox = $packer->pack();
Expand All @@ -116,7 +116,7 @@ public function runPublishedTestcase($problem, Box $box, ItemList $items): void
self::assertEquals(self::$expectedResults[$problem], $volumeUtilisation);
}

protected function thpackDecode($filename): array
protected static function thpackDecode($filename): array
{
$data = [];

Expand Down Expand Up @@ -151,9 +151,7 @@ protected function thpackDecode($filename): array
(int) $itemDimensions[5],
(bool) $itemDimensions[6]
);
for ($c = 1; $c <= $itemDimensions[7]; ++$c) {
$items->insert($item);
}
$items->insert($item, (int) $itemDimensions[7]);
}
$data[$problemId] = [$problemId, $box, $items, $itemTypeCount];
}
Expand Down
5 changes: 1 addition & 4 deletions tests/WorkingVolumeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
*/
class WorkingVolumeTest extends TestCase
{
/**
* @var WorkingVolume
*/
private $volume;
private WorkingVolume $volume;

protected function setUp(): void
{
Expand Down

0 comments on commit 2a29a27

Please sign in to comment.