Skip to content

Commit

Permalink
Simplify the classical tests
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Feb 20, 2025
1 parent edbe7ae commit aac9fe8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 60 deletions.
9 changes: 9 additions & 0 deletions tests/data/sample/classical.pgn
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,12 @@
36.a6 Be4+ 37.Kh3 Rg7 38.Rb6 Bf5+ 39.Kg2 Be4+ 40.Kh3 Re7 41.Bf4 Rf7 42.Bxe5 Rxf1
43.Bxd6 Rf3+ 44.Kh2 g5 45.hxg5 hxg5 46.Bxc5 *

[Event "-"]
[Site "-"]
[Date "-"]
[White "-"]
[Black "-"]
[Result "-"]

1.e4 e6 2.d4 d5 3.Nc3 Bb4 4.e5 c5 5.Qg4 Ne7 6.Nf3 Nbc6 7.a3 Bxc3+ 8.bxc3 Qc7 9.Rb1 O-O 10.Bd3 f5 11.exf6 *

62 changes: 2 additions & 60 deletions tests/unit/Variant/Classical/BoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static function setUpBeforeClass(): void
public function sample_classical()
{
$expected = [
'total' => 52,
'valid' => 52,
'total' => 53,
'valid' => 53,
];

$parser = new PgnParser(new Move(), self::DATA_FOLDER . "/sample/" . "classical.pgn");
Expand Down Expand Up @@ -192,32 +192,6 @@ public function pieces_in_A59()
$this->assertSame(13, count($board->pieces(Color::B)));
}

/**
* @test
*/
public function pieces_in_A74()
{
$A74 = file_get_contents(self::DATA_FOLDER.'/opening/A74.pgn');

$board = (new SanPlay($A74))->validate()->board;

$this->assertSame(15, count($board->pieces(Color::W)));
$this->assertSame(15, count($board->pieces(Color::B)));
}

/**
* @test
*/
public function pieces_in_B56()
{
$B56 = file_get_contents(self::DATA_FOLDER.'/opening/B56.pgn');

$board = (new SanPlay($B56))->validate()->board;

$this->assertSame(15, count($board->pieces(Color::W)));
$this->assertSame(15, count($board->pieces(Color::B)));
}

/**
* @test
*/
Expand Down Expand Up @@ -1384,38 +1358,6 @@ public function init_board_and_play_b_hxg3()
$this->assertTrue($board->play('b', 'hxg3'));
}

/**
* @test
*/
public function play_a_sequence_of_moves_w_exf6()
{
$board = new Board();
$this->assertTrue($board->play('w', 'e4'));
$this->assertTrue($board->play('b', 'e6'));
$this->assertTrue($board->play('w', 'd4'));
$this->assertTrue($board->play('b', 'd5'));
$this->assertTrue($board->play('w', 'Nc3'));
$this->assertTrue($board->play('b', 'Bb4'));
$this->assertTrue($board->play('w', 'e5'));
$this->assertTrue($board->play('b', 'c5'));
$this->assertTrue($board->play('w', 'Qg4'));
$this->assertTrue($board->play('b', 'Ne7'));
$this->assertTrue($board->play('w', 'Nf3'));
$this->assertTrue($board->play('b', 'Nbc6'));
$this->assertTrue($board->play('w', 'a3'));
$this->assertTrue($board->play('b', 'Bxc3+'));
$this->assertTrue($board->play('w', 'bxc3'));
$this->assertTrue($board->play('b', 'Qc7'));
$this->assertTrue($board->play('w', 'Rb1'));
$this->assertTrue($board->play('b', 'O-O'));
$this->assertTrue($board->play('w', 'Bd3'));
$this->assertTrue($board->play('b', 'f5'));
$pawn_e5 = $board->pieceBySq('e5');
$pawn_e5->moveSqs(); // this creates the en passant property
$this->assertSame('f6', $pawn_e5->xEnPassantSq);
$this->assertTrue($board->play('w', 'exf6'));
}

/**
* @test
*/
Expand Down

0 comments on commit aac9fe8

Please sign in to comment.