Skip to content

Instantly share code, notes, and snippets.

@bharath2020
Created January 24, 2016 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bharath2020/21b54e91f565b3312796 to your computer and use it in GitHub Desktop.
Save bharath2020/21b54e91f565b3312796 to your computer and use it in GitHub Desktop.
Tic-Tac-Toe Test if there is a win for player Horizontally
func testWinnerHorizontally(){
//Prepare: Setup the board and place markers such that player wins in horizontal direction
let board = TTBoard(boardIDString: NSUUID().UUIDString)
board.markPosition(0, playerCode: 1);
board.markPosition(3, playerCode: 2);
board.markPosition(1, playerCode: 1);
board.markPosition(5, playerCode: 2);
board.markPosition(2, playerCode: 1);
//Execute - obtain the winning player code
let winner = board.winner()
//Verfiy
let expectedWinner = 1;
XCTAssertEqual(winner, expectedWinner, "Failed Horizontal Winner");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment