|
@ -85,5 +85,22 @@ class AIHardTest { |
|
|
new char[][] { {'-', '-', '-'}, {'o', 'o', '-'}, {'-', '-', '-'} }, |
|
|
new char[][] { {'-', '-', '-'}, {'o', 'o', '-'}, {'-', '-', '-'} }, |
|
|
1, 'o', 2)); |
|
|
1, 'o', 2)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("testCasesForCountCharsInCol") |
|
|
|
|
|
void countCharsInColTest(String testName, char[][] board, int rowNum, char charToCount, int expectedResult) { |
|
|
|
|
|
doReturn(board).when(gl).getBoard(); |
|
|
|
|
|
|
|
|
|
|
|
AIHard ai = new AIHard(gl); |
|
|
|
|
|
int realResult = ai.countCharsInCol(rowNum, charToCount); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(realResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Stream<Arguments> testCasesForCountCharsInCol() { |
|
|
|
|
|
return Stream.of(Arguments.of("EmptyFieldReturns0", |
|
|
|
|
|
new char[][] { {'-', '-', '-'}, {'-', '-', '-'}, {'-', '-', '-'} }, |
|
|
|
|
|
0, 'o', 0)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |