aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-04-17 17:07:33 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2024-04-17 17:07:33 -0600
commit97998126b99500ba793a7a30c61d2991337182e5 (patch)
tree25a19c664f35b69c0df6d3871a28cdf538fabb4d
parent081adb89d7f5c8e80961e3873654be3473faef71 (diff)
add tests
-rw-r--r--Tests/SwiftChessNeoTests/PlayerTests.swift4
-rw-r--r--Tests/SwiftChessNeoTests/VariantTests.swift30
2 files changed, 10 insertions, 24 deletions
diff --git a/Tests/SwiftChessNeoTests/PlayerTests.swift b/Tests/SwiftChessNeoTests/PlayerTests.swift
index b21b33c..77535e7 100644
--- a/Tests/SwiftChessNeoTests/PlayerTests.swift
+++ b/Tests/SwiftChessNeoTests/PlayerTests.swift
@@ -8,7 +8,7 @@
import XCTest
@testable import SwiftChessNeo
-final class SwiftChessNeoPlayer: XCTestCase {
+final class PlayerTests: XCTestCase {
func testPlayerStruct() {
let player1 = Player(kind: .human, name: "Magnus Carlsen", elo: 2900)
@@ -19,7 +19,9 @@ final class SwiftChessNeoPlayer: XCTestCase {
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")
diff --git a/Tests/SwiftChessNeoTests/VariantTests.swift b/Tests/SwiftChessNeoTests/VariantTests.swift
index 4f0513e..896f18f 100644
--- a/Tests/SwiftChessNeoTests/VariantTests.swift
+++ b/Tests/SwiftChessNeoTests/VariantTests.swift
@@ -6,30 +6,14 @@
//
import XCTest
+@testable import SwiftChessNeo
final class VariantTests: XCTestCase {
-
- override func setUpWithError() throws {
- // Put setup code here. This method is called before the invocation of each test method in the class.
- }
-
- override func tearDownWithError() throws {
- // Put teardown code here. This method is called after the invocation of each test method in the class.
- }
-
- func testExample() throws {
- // This is an example of a functional test case.
- // Use XCTAssert and related functions to verify your tests produce the correct results.
- // Any test you write for XCTest can be annotated as throws and async.
- // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
- // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
- }
-
- func testPerformanceExample() throws {
- // This is an example of a performance test case.
- self.measure {
- // Put the code you want to measure the time of here.
- }
+
+ func testVariantEnum() {
+ let game = Game()
+
+ XCTAssertEqual(game.variant.isUpsideDown, false)
+ XCTAssertEqual(game.variant.isStandard, true)
}
-
}