Пример #1
0
 public function test_openValve()
 {
     $Steampunked = new Steampunked\Steampunked(self::SEED);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $Steampunked->openValve();
     $this->assertEquals($Steampunked->getWinnerName(), "p2");
     $this->assertEquals($Steampunked->getLoserName(), "p1");
     $Steampunked = new Steampunked\Steampunked(self::SEED);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $Steampunked->newTurn();
     $Steampunked->openValve();
     $this->assertEquals($Steampunked->getWinnerName(), "p1");
     $this->assertEquals($Steampunked->getLoserName(), "p2");
     $Steampunked = new Steampunked\Steampunked(self::SEED);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $Steampunked->newTurn();
     $Steampunked->addPipe(3, 1, 2);
     $Steampunked->openValve();
     $this->assertEquals($Steampunked->getWinnerName(), "p1");
     $this->assertEquals($Steampunked->getLoserName(), "p2");
     $Steampunked = new Steampunked\Steampunked(self::SEED);
     $Steampunked->setSize(6);
     $Steampunked->setPlayer("p1", "p2");
     $Steampunked->newTurn();
     $Steampunked->rotate(2);
     $Steampunked->rotate(2);
     $Steampunked->rotate(2);
     $Steampunked->addPipe(2, 6, 2);
     $Steampunked->addPipe(2, 6, 3);
     $Steampunked->addPipe(2, 6, 4);
     $Steampunked->addPipe(2, 6, 5);
     $Steampunked->addPipe(2, 6, 6);
     $Steampunked->addPipe(4, 6, 7);
     $Steampunked->addPipe(1, 5, 7);
     $Steampunked->addPipe(0, 5, 2);
     $Steampunked->addPipe(0, 5, 3);
     $Steampunked->addPipe(0, 5, 4);
     $Steampunked->addPipe(0, 5, 5);
     $Steampunked->addPipe(0, 5, 6);
     $Steampunked->openValve();
     $this->assertEquals($Steampunked->getWinnerName(), "p2");
     $this->assertEquals($Steampunked->getLoserName(), "p1");
     $this->assertEquals($Steampunked->getAllPipes()[4][8]->getName(), "gauge-top-190.png");
     $this->assertEquals($Steampunked->getAllPipes()[5][8]->getName(), "gauge-190.png");
     $this->assertEquals($Steampunked->getAllPipes()[6][1]->getName(), "valve-open.png");
 }