Пример #1
0
 public function test_updateClk()
 {
     $owner = new Steampunked\Player("p1", 6, 1);
     $owner->updateClk();
     $this->assertEquals(sizeof($owner->getClk()), 1);
     $this->assertEquals($owner->getClk()[1][2], "E");
     $Steampunked = new Steampunked\Steampunked(1);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $owner = $Steampunked->getTurn();
     $Steampunked->addPipe(2, 1, 2);
     $owner->updateClk();
     $this->assertEquals(sizeof($owner->getClk()), 2);
     $this->assertEquals($owner->getClk()[1][3], "E");
     $this->assertEquals($owner->getClk()[2][2], "S");
     $Steampunked = new Steampunked\Steampunked(1);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $owner = $Steampunked->getTurn();
     $Steampunked->addPipe(2, 1, 2);
     $Steampunked->addPipe(2, 1, 3);
     $owner->updateClk();
     $this->assertEquals(sizeof($owner->getClk()), 2);
     $this->assertEquals($owner->getClk()[1][4], "E");
     $this->assertEquals($owner->getClk()[2][2], "S");
     $this->assertEquals($owner->getClk()[2][3], "S");
 }
Пример #2
0
 public function test_indicateLeaks()
 {
     $owner = new Steampunked\Player("p1", 6, 1);
     $owner->getPipeline()[1][1]->indicateLeaks();
     $this->assertEquals(sizeof($owner->getClk()), 1);
     $this->assertEquals($owner->getClk()[1][2], "E");
     $owner = new Steampunked\Player("p1", 6, 1);
     $tile = new Steampunked\Tile("straight-h.png", array("N" => false, "W" => true, "S" => false, "E" => true));
     $owner->addPipe($tile, 1, 2);
     $owner->getPipeline()[1][1]->indicateLeaks();
     $this->assertEquals(sizeof($owner->getClk()), 1);
     $this->assertEquals($owner->getClk()[1][3], "E");
     $owner = new Steampunked\Player("p1", 6, 1);
     $tile = new Steampunked\Tile("straight-h.png", array("N" => false, "W" => true, "S" => false, "E" => true));
     $tee_swn = new Steampunked\Tile("tee-swn.png", array("N" => true, "W" => true, "S" => true, "E" => false));
     $owner->addPipe($tile, 1, 2);
     $owner->addPipe($tee_swn, 1, 3);
     $owner->getPipeline()[1][1]->indicateLeaks();
     $this->assertEquals(sizeof($owner->getClk()), 2);
     $this->assertEquals($owner->getClk()[0][3], "N");
     $this->assertEquals($owner->getClk()[2][3], "S");
 }