Skip to content

Commit

Permalink
Fix: test for rabbit starving.
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarchevskyi committed May 15, 2024
1 parent bdf3c6f commit bc8d408
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/ForestGame/ForestFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,19 @@ protected function testWolfStarving(): void

protected function testRabbitStarving(): void
{
$this->initFieldWithAlivePlants(2, 2);
$xSize = 2;
$ySize = 2;

$this->field = new ForestField($xSize, $ySize, false);

for ($i = 0; $i < $ySize; $i++) {
for ($j = 0; $j < $xSize; $j++) {
$this->field->setCell($j, $i, new PlantCell($j, $i, false, 10, 2));
}
}

$this->field->setCell(1, 0, new RabbitCell(1, 0, 2));

$this->field->nextStep();
$this->assertSame($this->field->getQuantityOfCells(RabbitCell::class, true), 1);
$this->field->nextStep();
$this->assertSame($this->field->getQuantityOfCells(RabbitCell::class, true), 1);
$this->field->nextStep();
Expand Down

0 comments on commit bc8d408

Please sign in to comment.