Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Dec 20, 2024
1 parent 513c229 commit 078acc0
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tests/unit/FenHeuristicsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,38 @@ public function get_balance_start()
$this->assertEquals($expected, $balance);
}

/**
* @test
*/
public function get_balance_c4()
{
$fen = 'rnbqkbnr/pppppppp/8/8/2P5/8/PP1PPPPP/RNBQKBNR b KQkq c3';

$board = FenToBoardFactory::create($fen);

$balance = (new FenHeuristics(self::$function, $board))->balance;

$expected = [ 0, 1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];

$this->assertEquals($expected, $balance);
}

/**
* @test
*/
public function get_balance_d4()
{
$fen = 'rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq d3';

$board = FenToBoardFactory::create($fen);

$balance = (new FenHeuristics(self::$function, $board))->balance;

$expected = [ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ];

$this->assertEquals($expected, $balance);
}

/**
* @test
*/
Expand All @@ -49,6 +81,38 @@ public function get_balance_e4()
$this->assertEquals($expected, $balance);
}

/**
* @test
*/
public function get_balance_f4()
{
$fen = 'rnbqkbnr/pppppppp/8/8/5P2/8/PPPPP1PP/RNBQKBNR b KQkq f3';

$board = FenToBoardFactory::create($fen);

$balance = (new FenHeuristics(self::$function, $board))->balance;

$expected = [ 0, 1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ];

$this->assertEquals($expected, $balance);
}

/**
* @test
*/
public function get_balance_g4()
{
$fen = 'rnbqkbnr/pppppppp/8/8/6P1/8/PPPPPP1P/RNBQKBNR b KQkq g3';

$board = FenToBoardFactory::create($fen);

$balance = (new FenHeuristics(self::$function, $board))->balance;

$expected = [ 0, 1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];

$this->assertEquals($expected, $balance);
}

/**
* @test
*/
Expand Down

0 comments on commit 078acc0

Please sign in to comment.