Created
January 24, 2016 02:21
-
-
Save bharath2020/21b54e91f565b3312796 to your computer and use it in GitHub Desktop.
Tic-Tac-Toe Test if there is a win for player Horizontally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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