parent
1fb9d2da9b
commit
e4e06c168f
@ -0,0 +1,26 @@
|
|||||||
|
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),
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in new issue