aboutsummaryrefslogtreecommitdiff
path: root/Tests/SwiftChessNeoTests/PlayerTests.swift
blob: 77535e7a2e56c2f9dc320f9b554aab051b37fcf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
//  SwiftChessNeoPlayer.swift
//  
//
//  Created by Navan Chauhan on 4/17/24.
//

import XCTest
@testable import SwiftChessNeo

final class PlayerTests: XCTestCase {
    
    func testPlayerStruct() {
        let player1 = Player(kind: .human, name: "Magnus Carlsen", elo: 2900)
        let player2 = Player(kind: .human, name: "Magnus Carlsen", elo: 2900)
        let player3 = Player(kind: .computer, name: "Magnot Carlsen", elo: 2900)
        
        XCTAssertEqual(player1.kind.isHuman, true)
        XCTAssertEqual(player1.kind.isComputer, false)
        XCTAssertEqual(player3.kind.isHuman, false)
        XCTAssertEqual(player3.kind.isComputer, true)
        
        XCTAssertEqual(player1, player2)
        XCTAssertNotEqual(player1, player3)
        
        XCTAssertEqual(player1.kind.description, "Human")
        XCTAssertEqual(player3.kind.description, "Computer")
        
        XCTAssertEqual(player1.description, "Player(kind: Human, name: Magnus Carlsen, elo: 2900)")
    }

}