You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.0 KiB

import XCTest
@testable import Model
class VerySimpleRulesTests: XCTestCase {
func testCreateBoard() {
// Test que la fonction createBoard() retourne un plateau valide avec les dimensions attendues
let board = VerySimpleRules.createBoard()
XCTAssertEqual(board.nbRows, 5)
XCTAssertEqual(board.nbColumns, 5)
}
func testGetNextPlayer() {
// Teste que la fonction getNextPlayer() retourne le joueur suivant en fonction de l'historique des coups
var rules = VerySimpleRules()
rules.historic.append(Move(owner: .player1, rowOrigin: 0, columnOrigin: 0, rowDestination: 0, columnDestination: 1))
XCTAssertEqual(rules.getNextPlayer(), .player2)
rules.historic.append(Move(owner: .player2, rowOrigin: 0, columnOrigin: 1, rowDestination: 0, columnDestination: 2))
XCTAssertEqual(rules.getNextPlayer(), .player1)
}
static var allTests = [
("testCreateBoard", testCreateBoard),
("testGetNextPlayer", testGetNextPlayer),
]
}