|
|
@ -176,6 +176,17 @@ class AIHardTest { |
|
|
|
verify(gl, times(1)).setField(2, 1, realChar); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void ifRowAndColWithSameNumberContainEachContainTwoCharsDontIgnoreCol() { |
|
|
|
char realChar = 'o'; |
|
|
|
doReturn(new char[][] { {'x', 'o', 'x'}, {'-', 'o', '-'}, {'o', 'x', 'x'} }).when(gl).getBoard(); |
|
|
|
|
|
|
|
TicTacToeAI ai = new AIHard(gl); |
|
|
|
ai.calculateNextMove(); |
|
|
|
|
|
|
|
verify(gl, times(1)).setField(1, 2, realChar); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("testCasesForCountCharsInRow") |
|
|
|
void countCharsInRowTest(String testName, char[][] board, int rowNum, char charToCount, int expectedResult) { |
|
|
|