Commit f046afea authored by miknatr's avatar miknatr
Browse files

Pawn movement tests

parent ae08181c
......@@ -4,19 +4,61 @@ class Test extends \PHPUnit_Framework_TestCase
{
public function testNoMoves()
{
$this->runFile('tests/no-moves.test');
$this->runFile('tests/001-no-moves.test');
}
public function testSimpleError()
{
$this->runFile('tests/011-simple-error.test');
}
public function testSimple()
{
$this->runFile('tests/simple-move.test');
$this->runFile('tests/012-simple-move.test');
}
public function testSimpleError()
public function testColorRotationError()
{
$this->runFile('tests/013-color-rotation-error.test');
}
public function testPawnMovesOneSquareVertically()
{
$this->runFile('tests/021-pawn-moves-one-square-vertically.test');
}
public function testPawnCanMoveTwoSquaresOnFirstMove()
{
$this->runFile('tests/022-pawn-can-move-two-squares-on-first-move.test');
}
public function testPawnCanNotMoveDiagonally()
{
$this->runFile('tests/023-pawn-can-not-move-diagonally.test');
}
public function testPawnCapturesDiagonally()
{
$this->runFile('tests/024-pawn-captures-diagonally.test');
}
public function testPawnCanNotCaptureVertically()
{
$this->runFile('tests/025-pawn-can-not-capture-vertically.test');
}
public function testPawnCanNotMoveFartherOneSquare()
{
$this->runFile('tests/026-pawn-can-not-move-farther-one-square.test');
}
public function testPawnCanNotMoveAcrossFigure()
{
$this->runFile('tests/simple-error.test');
$this->runFile('tests/027-pawn-can-not-move-across-figure.test');
}
private function runFile($file)
{
$lines = file($file);
......
e2-e3 e3-e4
error
Invalid move e3-e4
e2-e3 d7-d6 e3-e4
8 ♜♞♝♛♚♝♞♜
7 ♟♟♟-♟♟♟♟
6 -------
5 --------
4 -------
3 --------
2 ♙♙♙♙-♙♙♙
1 ♖♘♗♕♔♗♘♖
abcdefgh
e2-e4
8 ♜♞♝♛♚♝♞♜
7 ♟♟♟♟♟♟♟♟
6 --------
5 --------
4 -------
3 --------
2 ♙♙♙♙-♙♙♙
1 ♖♘♗♕♔♗♘♖
abcdefgh
e2-d3
error
Invalid move e2-d3
e2-e4 d7-d5 e4-d5
8 ♜♞♝♛♚♝♞♜
7 ♟♟♟-♟♟♟♟
6 --------
5 -------
4 --------
3 --------
2 ♙♙♙♙-♙♙♙
1 ♖♘♗♕♔♗♘♖
abcdefgh
e2-e4 e7-e5 e4-d5
error
Invalid move e4-d5
e2-e3 d7-d6 e3-e5
error
Invalid move e3-e5
e2-e3 a7-a5 e3-e4 a5-a4 e4-e5 a4-a3 a2-a4
error
Invalid move a2-a4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment