|
|
@ -88,11 +88,11 @@ class AIHardTest { |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("testCasesForCountCharsInCol") |
|
|
|
void countCharsInColTest(String testName, char[][] board, int rowNum, char charToCount, int expectedResult) { |
|
|
|
void countCharsInColTest(String testName, char[][] board, int colNum, char charToCount, int expectedResult) { |
|
|
|
doReturn(board).when(gl).getBoard(); |
|
|
|
|
|
|
|
AIHard ai = new AIHard(gl); |
|
|
|
int realResult = ai.countCharsInCol(rowNum, charToCount); |
|
|
|
int realResult = ai.countCharsInCol(colNum, charToCount); |
|
|
|
|
|
|
|
assertThat(realResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
} |
|
|
@ -106,4 +106,21 @@ class AIHardTest { |
|
|
|
1, 'o', 1)); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("testCasesForCountCharsInDiag") |
|
|
|
void countCharsInDiagTest(String testName, char[][] board, int diagNum, char charToCount, int expectedResult) { |
|
|
|
doReturn(board).when(gl).getBoard(); |
|
|
|
|
|
|
|
AIHard ai = new AIHard(gl); |
|
|
|
int realResult = ai.countCharsInDiag(diagNum, charToCount); |
|
|
|
|
|
|
|
assertThat(realResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
} |
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCountCharsInDiag() { |
|
|
|
return Stream.of(Arguments.of("EmptyFieldReturns0", |
|
|
|
new char[][] { {'-', '-', '-'}, {'-', '-', '-'}, {'-', '-', '-'} }, |
|
|
|
0, 'o', 0)); |
|
|
|
} |
|
|
|
|
|
|
|
} |