aboutsummaryrefslogtreecommitdiff
path: root/Tests/SwiftChessNeoTests
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-04-17 15:25:27 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2024-04-17 15:25:27 -0600
commitac627be0303bdb611fb04ae72f0f72afa4d3372b (patch)
tree1a04453fc04be7c54a4b92e2d4e374040f72cb1b /Tests/SwiftChessNeoTests
parenta02c482e83c7e7a4eaf5a2ee0b69f5b45c5dfcf5 (diff)
add tests for Player
Diffstat (limited to 'Tests/SwiftChessNeoTests')
-rw-r--r--Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift b/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift
new file mode 100644
index 0000000..b21b33c
--- /dev/null
+++ b/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift
@@ -0,0 +1,30 @@
+//
+// SwiftChessNeoPlayer.swift
+//
+//
+// Created by Navan Chauhan on 4/17/24.
+//
+
+import XCTest
+@testable import SwiftChessNeo
+
+final class SwiftChessNeoPlayer: 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)
+
+ XCTAssertEqual(player1.kind.description, "Human")
+ XCTAssertEqual(player3.kind.description, "Computer")
+
+ XCTAssertEqual(player1.description, "Player(kind: Human, name: Magnus Carlsen, elo: 2900)")
+ }
+
+}