import XCTest @testable import Model final class RandomPlayerTests: XCTestCase { func testInit() { for t in [PieceType.A, .B] { let p = RandomPlayer(name: "the name", piece_type: t) XCTAssertEqual(p.name, "the name") XCTAssertEqual(p.piece_type, t) } } func testChoose() async { let board = Board(columns: 3, rows: 3)! let moves: [Move.Action] = [.InsertAt(where: Coords(1, 2)), .InsertOnSide(side: .Left, offset: 1)] let player = RandomPlayer(name: "name", piece_type: .A) // +5 test quality credits for _ in 1...10 { let choosen = await player.chooseMove(allowed_moves: moves, board: board) XCTAssertNotNil(moves.firstIndex(of: choosen)) } } }