Browse Source

4gewinnt: refactored calcScore testmethods

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
e2bd09d713
  1. 16
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

16
src/test/java/de/tims/viergewinnt/ai/LogicTest.java

@ -68,12 +68,10 @@ class LogicTest {
assertEquals(expectedResult, realResult);
}
@Test
void calcScoreTest() {
int[][] playfield = new int[6][6];
int player = 1;
int expectedResult = 0;
@ParameterizedTest(name = "[{index}] {0} Win for Player {2} {1}")
@MethodSource("playfieldForScore")
void calcScoreTest(String testName, int[][] playfield, int player, int expectedResult) {
int realResult = testObj.calcScore(playfield, player);
assertEquals(expectedResult, realResult);
@ -119,5 +117,11 @@ class LogicTest {
Arguments.of("4 diagonal left player1", playfield5, 1, true)
);
}
private static Stream<Arguments> playfieldForScore() {
return Stream.of(
Arguments.of("emptyField", new int[6][6], 1, 0)
);
}
}
Loading…
Cancel
Save