/
DiagonalOppositionEvalTest.php
73 lines (59 loc) · 2.02 KB
/
DiagonalOppositionEvalTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace Chess\Tests\Unit\Eval;
use Chess\Eval\DiagonalOppositionEval;
use Chess\Variant\Classical\FEN\StrToBoard;
use Chess\Tests\AbstractUnitTestCase;
class DiagonalOppositionEvalTest extends AbstractUnitTestCase
{
/**
* @test
*/
public function position_01()
{
$expectedResult = [
'w' => 1,
'b' => 0,
];
$expectedPhrase = [
"The white king has the diagonal opposition preventing the advance of the other king.",
];
$board = (new StrToBoard('8/8/2K5/8/4k3/8/8/8 b - - 0 1'))->create();
$directOppositionEval = new DiagonalOppositionEval($board);
$this->assertSame($expectedResult, $directOppositionEval->getResult());
$this->assertSame($expectedPhrase, $directOppositionEval->getExplanation());
}
/**
* @test
*/
public function position_02()
{
$expectedResult = [
'w' => 1,
'b' => 0,
];
$expectedPhrase = [
"The white king has the diagonal opposition preventing the advance of the other king.",
];
$board = (new StrToBoard('5k2/6p1/3K2P1/5P2/8/8/8/8 b - - 0 1'))->create();
$directOppositionEval = new DiagonalOppositionEval($board);
$this->assertSame($expectedResult, $directOppositionEval->getResult());
$this->assertSame($expectedPhrase, $directOppositionEval->getExplanation());
}
/**
* @test
*/
public function position_03()
{
$expectedResult = [
'w' => 0,
'b' => 1,
];
$expectedPhrase = [
"The black king has the diagonal opposition preventing the advance of the other king.",
];
$board = (new StrToBoard('8/8/8/8/8/2K5/8/k7 w - - 0 1'))->create();
$directOppositionEval = new DiagonalOppositionEval($board);
$this->assertSame($expectedResult, $directOppositionEval->getResult());
$this->assertSame($expectedPhrase, $directOppositionEval->getExplanation());
}
}