From 081adb89d7f5c8e80961e3873654be3473faef71 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 17 Apr 2024 17:07:24 -0600 Subject: add option to get image name --- Tests/SwiftChessNeoTests/PlayerTests.swift | 30 +++++++++++++++++++ Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift | 30 ------------------- Tests/SwiftChessNeoTests/VariantTests.swift | 35 ++++++++++++++++++++++ 3 files changed, 65 insertions(+), 30 deletions(-) create mode 100644 Tests/SwiftChessNeoTests/PlayerTests.swift delete mode 100644 Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift create mode 100644 Tests/SwiftChessNeoTests/VariantTests.swift (limited to 'Tests') diff --git a/Tests/SwiftChessNeoTests/PlayerTests.swift b/Tests/SwiftChessNeoTests/PlayerTests.swift new file mode 100644 index 0000000..b21b33c --- /dev/null +++ b/Tests/SwiftChessNeoTests/PlayerTests.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)") + } + +} diff --git a/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift b/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift deleted file mode 100644 index b21b33c..0000000 --- a/Tests/SwiftChessNeoTests/SwiftChessNeoPlayer.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// 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)") - } - -} diff --git a/Tests/SwiftChessNeoTests/VariantTests.swift b/Tests/SwiftChessNeoTests/VariantTests.swift new file mode 100644 index 0000000..4f0513e --- /dev/null +++ b/Tests/SwiftChessNeoTests/VariantTests.swift @@ -0,0 +1,35 @@ +// +// VariantTests.swift +// +// +// Created by Navan Chauhan on 4/17/24. +// + +import XCTest + +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. + } + } + +} -- cgit v1.2.3