Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Apr 26, 2023
1 parent be0f5c1 commit 4a04657
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/unit/Variant/Chess960/BoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,31 @@ public function play_NBQNRKBR_h3_h6_Bh2_Bh7_Kg1_undo()

$this->assertSame($expected, $board->toAsciiArray());
}

/**
* @test
*/
public function play_RNNQBKRB_O_O_undo()
{
$startPos = ['R', 'N', 'N', 'Q', 'B', 'K', 'R', 'B'];

$board = new Board($startPos);

$this->assertTrue($board->play('w', 'O-O'));

$board = $board->undo();

$expected = [
7 => [ ' r ', ' n ', ' n ', ' q ', ' b ', ' k ', ' r ', ' b ' ],
6 => [ ' p ', ' p ', ' p ', ' p ', ' p ', ' p ', ' p ', ' p ' ],
5 => [ ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ' ],
4 => [ ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ' ],
3 => [ ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ' ],
2 => [ ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ', ' . ' ],
1 => [ ' P ', ' P ', ' P ', ' P ', ' P ', ' P ', ' P ', ' P ' ],
0 => [ ' R ', ' N ', ' N ', ' Q ', ' B ', ' K ', ' R ', ' B ' ],
];

$this->assertSame($expected, $board->toAsciiArray());
}
}

0 comments on commit 4a04657

Please sign in to comment.