Esempio n. 1
0
 public function test_neighbor()
 {
     $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);
     $this->assertEquals($owner->neighbor("E", 1, 2), array(null, 1, 3));
     $this->assertInstanceOf('Steampunked\\Tile', $owner->neighbor("W", 1, 2)[0]);
     $tee_swn = new Steampunked\Tile("tee-swn.png", array("N" => true, "W" => true, "S" => true, "E" => false));
     $owner->addPipe($tee_swn, 1, 3);
     $this->assertEquals($owner->neighbor("N", 1, 3), array(null, 0, 3));
     $this->assertEquals($owner->neighbor("S", 1, 3), array(null, 2, 3));
 }
Esempio n. 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");
 }