Browse Source

Refact6oring: ai-logicTest restructured

fleetstorm
Max Wenzel 3 years ago
committed by Lorenz Hohmann
parent
commit
d847e33ef5
  1. 12
      src/test/java/de/tims/fleetstorm/ai/LogicTest.java

12
src/test/java/de/tims/fleetstorm/ai/LogicTest.java

@ -9,12 +9,13 @@ import de.tims.fleetstorm.matchfield.Coordinate;
import de.tims.fleetstorm.matchfield.Matchfield; import de.tims.fleetstorm.matchfield.Matchfield;
class LogicTest { class LogicTest {
Logic logic = new Logic();
int size = 3;
private Matchfield matchfield = new Matchfield(size);
@Test @Test
void testFieldIsNotNull() { void testFieldIsNotNull() {
Logic logic = new Logic();
Matchfield matchfield;
int size = 5;
matchfield = new Matchfield(size);
matchfield.createMatchfield(); matchfield.createMatchfield();
Coordinate calcResult = logic.chooseField(matchfield); Coordinate calcResult = logic.chooseField(matchfield);
assertNotNull(calcResult); assertNotNull(calcResult);
@ -22,7 +23,12 @@ class LogicTest {
@Test @Test
void testChoosenFieldHasNotStateShot() { void testChoosenFieldHasNotStateShot() {
Logic logic = new Logic();
Matchfield matchfield;
int size = 5;
matchfield = new Matchfield(size);
matchfield.createMatchfield(); matchfield.createMatchfield();
for (int x = 0; x < size; x++) { for (int x = 0; x < size; x++) {
for (int y = 0; y < size; y++) { for (int y = 0; y < size; y++) {
// matchfield.setState(x, y, Matchfield.SHOT); // matchfield.setState(x, y, Matchfield.SHOT);

Loading…
Cancel
Save