Esempio n. 1
0
static void testOnlyWorthMovePlayed(Game *game, BoardCoord coord) {
  if(testMoveWorthChecking(game,  createPlayMove(coord))) {
    assert(getBoardCell(&game->board, coord) != emptyBoardCell);
  } else {
    assert(getBoardCell(&game->board, coord) == emptyBoardCell);
  }
}
Esempio n. 2
0
TEST(Board_test,putPieceOutsideTheBoard) {
  EXPECT_EQ(0, createBoard());
  EXPECT_EQ(1, putPiece(-1,0,0));
  EXPECT_EQ(1, putPiece(0,3,CROSS));
  EXPECT_EQ(EMPTY,getBoardCell(0,1));

  EXPECT_EQ(1, putPiece(3,3,CIRCLE));
  EXPECT_EQ(EMPTY,getBoardCell(0,2));
}
Esempio n. 3
0
TEST(Board_test,putPieceOnBoard) {
  EXPECT_EQ(0, createBoard());
  EXPECT_EQ(0, putPiece(0,0,0));
  EXPECT_EQ(0, putPiece(0,1,CROSS));
  EXPECT_EQ(CROSS,getBoardCell(0,1));

  EXPECT_EQ(0, putPiece(0,2,CIRCLE));
  EXPECT_EQ(CIRCLE,getBoardCell(0,2));
}
Esempio n. 4
0
TEST(Board_test,putPieceOnAnotherOne) {
  EXPECT_EQ(0, createBoard());
  EXPECT_EQ(0, putPiece(1,1,CROSS));
  EXPECT_EQ(1, putPiece(1,1,CROSS));
  EXPECT_EQ(CROSS,getBoardCell(1,1));

  EXPECT_EQ(0, putPiece(2,1,CIRCLE));
  EXPECT_EQ(1, putPiece(2,1,CROSS));
  EXPECT_EQ(CIRCLE,getBoardCell(2,1));
}
Esempio n. 5
0
TEST(Board_test, CreateBoard) {
  EXPECT_EQ(0, createBoard());

  EXPECT_EQ(EMPTY,getBoardCell(0,0));
  EXPECT_EQ(EMPTY,getBoardCell(0,1));
  EXPECT_EQ(EMPTY,getBoardCell(0,2));

  EXPECT_EQ(EMPTY,getBoardCell(1,0));
  EXPECT_EQ(EMPTY,getBoardCell(1,1));
  EXPECT_EQ(EMPTY,getBoardCell(1,2));

  EXPECT_EQ(EMPTY,getBoardCell(2,0));
  EXPECT_EQ(EMPTY,getBoardCell(2,1));
  EXPECT_EQ(EMPTY,getBoardCell(2,2));
}
Esempio n. 6
0
static void noHandicapByDefault(void) {
  char *argv[] = { "", "--handicap", "5" };
  Goro goro = createGoroFromCLIOption(3, argv);
  assert(getBoardCell(&goro.game->board, boardTengen(&goro.game->board))
         == blackBoardCell);
}
Esempio n. 7
0
static void createdGameHasGivenBoard(void) {
  Board board = createBoard(13,19);
  setBoardCell(&board, createBoardCoord(4,5), blackBoardCell);
  Game game = createGame(board);
  assert(getBoardCell(&game.board, createBoardCoord(4,5)) == blackBoardCell);
}
Esempio n. 8
0
static void playedMoveRegisteredOnBoard(void) {
  Game game = exampleStartedGameWithMove(examplePlayMove());
  assert(getBoardCell(&game.board, createBoardCoord(1,2)) == blackBoardCell);
}