Skip to content

Commit

Permalink
Fixed warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBarnegren committed Oct 19, 2017
1 parent 8c138eb commit 1c4e3c1
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Example/Tests/BoardRaterCenterFourOccupationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class BoardRaterCenterFourOccupationTests: XCTestCase {
"P P P P P P P P" )

let rating = defaultBoardRater().ratingfor(board: board.board, color: .white)
XCTAssertEqualWithAccuracy(rating, 0, accuracy: 0.01)
XCTAssertEqual(rating, 0, accuracy: 0.01)
}

func testOpponentOccupationResultsInNegativeRating() {
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/BoardRaterCheckMateOpportunityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class BoardRaterCheckMateOpportunityTests: XCTestCase {
let blackRating = boardRater.ratingfor(board: board, color: .black)

let accuracy = Double(0.1)
XCTAssertEqualWithAccuracy(whiteRating, 0, accuracy: accuracy)
XCTAssertEqualWithAccuracy(blackRating, 0, accuracy: accuracy)
XCTAssertEqual(whiteRating, 0, accuracy: accuracy)
XCTAssertEqual(blackRating, 0, accuracy: accuracy)
}

func testThatOpponentKingCheckMateOpportunityResultsInPositiveRating() {
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/BoardRaterKingSurroundingPossession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class BoardRaterKingSurroundingPossessionTests: XCTestCase {
let rating = boardRater.ratingfor(board: board.board, color: .white)
let invertedRating = boardRater.ratingfor(board: invertedBoard.board, color: .black)

XCTAssertEqualWithAccuracy(rating, invertedRating, accuracy: 0.01)
XCTAssertEqual(rating, invertedRating, accuracy: 0.01)
}

func testThatPiecesSurroundingOwnKingResultsInPositiveRatingForWhite() {
Expand Down
8 changes: 4 additions & 4 deletions Example/Tests/BoardRaterPawnProgressionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class BoardRaterPawnProgressionTests: XCTestCase {

let rating = boardRater.ratingfor(board: board.board, color: .white)

XCTAssertEqualWithAccuracy(rating, 0, accuracy: 0.0001)
XCTAssertEqual(rating, 0, accuracy: 0.0001)
}

func testBlackPawnsOnStartingRowResultInZeroRating() {
Expand All @@ -107,7 +107,7 @@ class BoardRaterPawnProgressionTests: XCTestCase {

let rating = boardRater.ratingfor(board: board.board, color: .black)

XCTAssertEqualWithAccuracy(rating, 0, accuracy: 0.0001)
XCTAssertEqual(rating, 0, accuracy: 0.0001)
}

func testWhiteAndBlackPawnRelativeSquaresResultInTheSameValue() {
Expand All @@ -124,7 +124,7 @@ class BoardRaterPawnProgressionTests: XCTestCase {
let whiteRating = boardRater.ratingfor(board: board.board, color: .white)
let blackRating = boardRater.ratingfor(board: board.board, color: .black)

XCTAssertEqualWithAccuracy(whiteRating, blackRating, accuracy: 0.0001)
XCTAssertEqual(whiteRating, blackRating, accuracy: 0.0001)
}

func testTotalWhiteAndBlackRowsValueAreEqual() {
Expand All @@ -141,7 +141,7 @@ class BoardRaterPawnProgressionTests: XCTestCase {
let whiteRating = boardRater.ratingfor(board: board.board, color: .white)
let blackRating = boardRater.ratingfor(board: board.board, color: .black)

XCTAssertEqualWithAccuracy(whiteRating, blackRating, accuracy: 0.0001)
XCTAssertEqual(whiteRating, blackRating, accuracy: 0.0001)
}


Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/BoardRaterThreatenedPiecesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BoardRaterThreatenedPiecesTests: XCTestCase {

let rating = boardRater.ratingfor(board: board.board, color: .white)

XCTAssertEqualWithAccuracy(rating, 0, accuracy: 0.01)
XCTAssertEqual(rating, 0, accuracy: 0.01)
}

func testBoardRaterThreatenedPiecesReturnsNegativeValueIfThreatened() {
Expand Down
25 changes: 12 additions & 13 deletions Example/Tests/BoardTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ class BoardTests: XCTestCase {
"- - - - - - - -" +
"- - - - - - - -" +
"- - - - G - - R" )
let gameBoard = board.board

XCTAssertTrue(board.board.canColorCastle(color: .white, side: .kingSide))
}
Expand Down Expand Up @@ -835,46 +834,46 @@ class BoardTests: XCTestCase {
func testCheckingForCheckDoesntResultInHasMovedFlagChange() {

let board = createHasMovedTestBoard()
board.isColorInCheck(color: .white)
board.isColorInCheck(color: .black)
_ = board.isColorInCheck(color: .white)
_ = board.isColorInCheck(color: .black)

XCTAssertFalse(areAnyPiecesHasMovedFlagsSet(on: board))
}

func testCheckingForCheckMateDoesntResultInHasMovedFlagChange() {

let board = createHasMovedTestBoard()
board.isColorInCheckMate(color: .white)
board.isColorInCheckMate(color: .black)
_ = board.isColorInCheckMate(color: .white)
_ = board.isColorInCheckMate(color: .black)

XCTAssertFalse(areAnyPiecesHasMovedFlagsSet(on: board))
}

func testCheckingForStaleMateDoesntResultInHasMovedFlagChange() {

let board = createHasMovedTestBoard()
board.isColorInStalemate(color: .white)
board.isColorInStalemate(color: .black)
_ = board.isColorInStalemate(color: .white)
_ = board.isColorInStalemate(color: .black)

XCTAssertFalse(areAnyPiecesHasMovedFlagsSet(on: board))
}

func testCheckingForAbilityToMoveDoesntResultInHasMovedFlagChange() {

let board = createHasMovedTestBoard()
board.isColorAbleToMove(color: .white)
board.isColorAbleToMove(color: .black)
_ = board.isColorAbleToMove(color: .white)
_ = board.isColorAbleToMove(color: .black)

XCTAssertFalse(areAnyPiecesHasMovedFlagsSet(on: board))
}

func testCheckingForAbilityToCastleDoesntResultInHasMovedFlagChange() {

let board = createHasMovedTestBoard()
board.canColorCastle(color: .white, side: .kingSide)
board.canColorCastle(color: .white, side: .queenSide)
board.canColorCastle(color: .black, side: .kingSide)
board.canColorCastle(color: .black, side: .queenSide)
_ = board.canColorCastle(color: .white, side: .kingSide)
_ = board.canColorCastle(color: .white, side: .queenSide)
_ = board.canColorCastle(color: .black, side: .kingSide)
_ = board.canColorCastle(color: .black, side: .queenSide)

XCTAssertFalse(areAnyPiecesHasMovedFlagsSet(on: board))
}
Expand Down
40 changes: 20 additions & 20 deletions Example/Tests/PerformanceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
pawn.movement.canPieceMove(fromLocation: pawnLocation,
toLocation: $0,
board: board)
_ = pawn.movement.canPieceMove(fromLocation: pawnLocation,
toLocation: $0,
board: board)
}
}
}
Expand Down Expand Up @@ -69,9 +69,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
queen.movement.canPieceMove(fromLocation: queenLocation,
toLocation: $0,
board: board)
_ = queen.movement.canPieceMove(fromLocation: queenLocation,
toLocation: $0,
board: board)
}
}
}
Expand Down Expand Up @@ -100,9 +100,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
king.movement.canPieceMove(fromLocation: kingLocation,
toLocation: $0,
board: board)
_ = king.movement.canPieceMove(fromLocation: kingLocation,
toLocation: $0,
board: board)
}
}
}
Expand Down Expand Up @@ -131,9 +131,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
knight.movement.canPieceMove(fromLocation: knightLocation,
toLocation: $0,
board: board)
_ = knight.movement.canPieceMove(fromLocation: knightLocation,
toLocation: $0,
board: board)
}
}
}
Expand Down Expand Up @@ -162,9 +162,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
bishop.movement.canPieceMove(fromLocation: bishopLocation,
toLocation: $0,
board: board)
_ = bishop.movement.canPieceMove(fromLocation: bishopLocation,
toLocation: $0,
board: board)
}
}
}
Expand Down Expand Up @@ -193,9 +193,9 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
rook.movement.canPieceMove(fromLocation: rookLocation,
toLocation: $0,
board: board)
_ = rook.movement.canPieceMove(fromLocation: rookLocation,
toLocation: $0,
board: board)
}
}
}
Expand All @@ -216,8 +216,8 @@ class PerformanceTests: XCTestCase {
self.measure {

BoardLocation.all.forEach{
board.canColorMoveAnyPieceToLocation(color: .white, location: $0)
board.canColorMoveAnyPieceToLocation(color: .black, location: $0)
_ = board.canColorMoveAnyPieceToLocation(color: .white, location: $0)
_ = board.canColorMoveAnyPieceToLocation(color: .black, location: $0)
}
}

Expand Down

0 comments on commit 1c4e3c1

Please sign in to comment.