Beispiel #1
0
 @Test
 public void testIfBoardIsFull() {
   Board testBoard = new Board();
   testBoard.mark(0, 0, 'x');
   testBoard.mark(0, 1, 'x');
   testBoard.mark(0, 2, 'x');
   testBoard.mark(1, 0, 'x');
   testBoard.mark(1, 1, 'x');
   testBoard.mark(1, 2, 'x');
   testBoard.mark(2, 0, 'x');
   testBoard.mark(2, 1, 'x');
   testBoard.mark(2, 2, 'x');
   assertEquals(true, testBoard.isFull());
 }
Beispiel #2
0
  public void move() {
    String input = "0";
    printStream.println("Please enter a number to move (1 to 9):");

    try {
      input = reader.readLine();
    } catch (IOException e) {
      e.printStackTrace();
    }

    board.mark(input, symbols.get(playerNumber));
  }
Beispiel #3
0
 @Test
 public void markBoard() {
   char[][] testArray = new char[3][3];
   for (int i = 0; i < 3; i++) {
     for (int j = 0; j < 3; j++) {
       testArray[i][j] = '-';
     }
   }
   testArray[1][2] = 'x';
   Board testBoard = new Board();
   testBoard.mark(1, 2, 'x');
   assertArrayEquals(testArray, testBoard.getBoard());
 }
Beispiel #4
0
 @Test
 public void getMarkTest() {
   Board testBoard = new Board();
   testBoard.mark(1, 2, 'x');
   assertEquals('x', testBoard.getMark(1, 2));
 }