|
@ -1,16 +1,35 @@ |
|
|
package de.tims.fleetstorm.ai; |
|
|
package de.tims.fleetstorm.ai; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotEquals; |
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull; |
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
import de.tims.fleetstorm.matchfield.Matchfield; |
|
|
|
|
|
|
|
|
class LogicTest { |
|
|
class LogicTest { |
|
|
Logic logic = new Logic(); |
|
|
Logic logic = new Logic(); |
|
|
|
|
|
int size = 3; |
|
|
|
|
|
private Matchfield matchfield = new Matchfield(size); |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void testFielIsNotNull() { |
|
|
|
|
|
int[] calcResult = logic.chooseField(); |
|
|
|
|
|
|
|
|
void testFieldIsNotNull() { |
|
|
|
|
|
int[] calcResult = logic.chooseField(matchfield); |
|
|
assertNotNull(calcResult); |
|
|
assertNotNull(calcResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testChoosenFieldHasNotStateShot() { |
|
|
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
for (int x = 0; x < size; x++) { |
|
|
|
|
|
for (int y = 0; y < size; y++) { |
|
|
|
|
|
// matchfield.setState(x, y, Matchfield.SHOT); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// matchfield.setState(0, 0, Matchfield.EMPTY); |
|
|
|
|
|
|
|
|
|
|
|
int[] choosenField = logic.chooseField(matchfield); |
|
|
|
|
|
int calcState = matchfield.getState(choosenField[0], choosenField[1]); |
|
|
|
|
|
assertNotEquals(calcState, Matchfield.SHOT); |
|
|
|
|
|
} |
|
|
} |
|
|
} |