parent
92dd6035ca
commit
494ea00fb3
@ -0,0 +1,92 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Louis DUFOUR on 31/01/2024.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Model
|
||||
import XCTest
|
||||
|
||||
/*
|
||||
// Mocks et Stubs
|
||||
class MockBoard: Board {
|
||||
// Implémentez les méthodes nécessaires
|
||||
}
|
||||
|
||||
class MockRules: VerySimpleRules {
|
||||
var mockMoves: [Move] = []
|
||||
|
||||
func getMoves(board: Board, owner: Owner) -> [Move] {
|
||||
return mockMoves
|
||||
}
|
||||
}
|
||||
|
||||
class MockMove: Move {
|
||||
// Implémentez les détails nécessaires
|
||||
}
|
||||
|
||||
// Tests
|
||||
class PlayerTests: XCTestCase {
|
||||
func testPlayerInitialization() {
|
||||
let player = Player(name: "TestPlayer", id: .player1)
|
||||
XCTAssertNotNil(player)
|
||||
XCTAssertEqual(player.name, "TestPlayer")
|
||||
// Plus d'assertions pour id
|
||||
}
|
||||
}
|
||||
|
||||
class HumanPlayerTests: XCTestCase {
|
||||
var mockBoard: MockBoard!
|
||||
var mockRules: MockRules!
|
||||
var mockMove: MockMove!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
mockBoard = MockBoard()
|
||||
mockRules = MockRules()
|
||||
mockMove = MockMove()
|
||||
}
|
||||
|
||||
func testHumanPlayerInitialization() {
|
||||
let humanPlayer = HumanPlayer(name: "Human", id: .player1, inputMethod: { _, _ in return self.mockMove })
|
||||
XCTAssertNotNil(humanPlayer)
|
||||
XCTAssertEqual(humanPlayer.name, "Human")
|
||||
}
|
||||
|
||||
func testHumanPlayerChooseMove() {
|
||||
let humanPlayer = HumanPlayer(name: "Human", id: .player1, inputMethod: { _, _ in return self.mockMove })
|
||||
let move = humanPlayer.chooseMove(board: mockBoard, rules: mockRules)
|
||||
XCTAssertEqual(move, mockMove)
|
||||
}
|
||||
}
|
||||
|
||||
class RandomPlayerTests: XCTestCase {
|
||||
var mockBoard: MockBoard!
|
||||
var mockRules: MockRules!
|
||||
var mockMove: MockMove!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
mockBoard = MockBoard()
|
||||
mockRules = MockRules()
|
||||
mockMove = MockMove()
|
||||
mockRules.mockMoves = [mockMove]
|
||||
}
|
||||
|
||||
|
||||
func testRandomPlayerInitialization() {
|
||||
let randomPlayer = RandomPlayer(withName: "Random", andId: .player2)
|
||||
XCTAssertNotNil(randomPlayer)
|
||||
XCTAssertEqual(randomPlayer.name, "Random")
|
||||
}
|
||||
|
||||
func testRandomPlayerChooseMove() {
|
||||
let randomPlayer = RandomPlayer(withName: "Random", andId: .player2)
|
||||
let move = randomPlayer.chooseMove(board: mockBoard, rules: mockRules)
|
||||
XCTAssertNotNil(move)
|
||||
}
|
||||
}*/
|
||||
|
||||
|
Loading…
Reference in new issue