Browse Source

Add Gameboard.java and GameboardTest.java

AIPlayer
Jonas Wagner 3 years ago
parent
commit
cc3c752612
  1. 8
      src/main/java/Gameboard.java
  2. 36
      src/test/java/GameboardTest.java

8
src/main/java/Gameboard.java

@ -0,0 +1,8 @@
public class Gameboard {
int[][] board;
public Gameboard() {
board = new int[11][11];
}
}

36
src/test/java/GameboardTest.java

@ -0,0 +1,36 @@
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class GameboardTest {
private Gameboard gb;
@BeforeEach
void setup() {
gb = new Gameboard();
}
@Test
void checkGameboardSize() {
String expectedResult = "11, 11";
String currentResult = "" + gb.board.length + ", " + gb.board[0].length;
assertThat(currentResult).describedAs("Dimensions").isEqualTo(expectedResult);
}
@Test
void checkGameboardFilled() {
int[][] expectedGameboard = new int[11][11];
for(int i = 0; i < expectedGameboard.length; i++) {
for(int j = 0; j < expectedGameboard[0].length; j++) {
expectedGameboard[i][j] = 0;
}
}
int [][] givenGameboard = gb.board;
assertThat(givenGameboard).describedAs("Initial Gameboard").isEqualTo(expectedGameboard);
}
}
Loading…
Cancel
Save