|
|
@ -2,8 +2,13 @@ package de.tims.viergewinnt.ai; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
class LogicTest { |
|
|
|
|
|
|
@ -14,14 +19,19 @@ class LogicTest { |
|
|
|
testObj = new Logic(); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void testForWinTest() { |
|
|
|
int[][] testField = new int[6][6]; |
|
|
|
boolean expectedResult = false; |
|
|
|
@ParameterizedTest(name = "[{index}] {0} Player {2} {3}") |
|
|
|
@MethodSource("playfieldResults") |
|
|
|
void testForWinTest(String testName, int[][] playfield, int player, boolean expectedResult) { |
|
|
|
|
|
|
|
boolean realResult = testObj.testForWin(testField, 1); |
|
|
|
boolean realResult = testObj.testForWin(playfield, player); |
|
|
|
|
|
|
|
assertEquals(expectedResult, realResult); |
|
|
|
} |
|
|
|
|
|
|
|
private static Stream<Arguments> playfieldResults() { |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("emptyField", new int[6][6], 1, false) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
} |