aboutsummaryrefslogtreecommitdiff
path: root/Tests/swift-lichessTests
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-04-24 01:57:08 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2024-04-24 01:57:08 -0600
commitf1cc08c4c3bfbc844047dd7b6b68bc6fab9baedf (patch)
treea18ec0845c2a360b661aec415709af2cccf74995 /Tests/swift-lichessTests
initial commit
Diffstat (limited to 'Tests/swift-lichessTests')
-rw-r--r--Tests/swift-lichessTests/swift_lichessTests.swift35
1 files changed, 35 insertions, 0 deletions
diff --git a/Tests/swift-lichessTests/swift_lichessTests.swift b/Tests/swift-lichessTests/swift_lichessTests.swift
new file mode 100644
index 0000000..cf125aa
--- /dev/null
+++ b/Tests/swift-lichessTests/swift_lichessTests.swift
@@ -0,0 +1,35 @@
+import XCTest
+
+@testable import LichessClient
+
+final class swift_lichessTests: XCTestCase {
+
+ func testTablebaseLookup() async throws {
+ let client = LichessClient()
+
+ let tablebaseLookup = try await client.getStandardTablebase(
+ fen: "4k3/6KP/8/8/8/8/7p/8_w_-_-_0_1")
+ guard let dtm = tablebaseLookup.dtm else {
+ XCTAssert(false == true)
+ return
+ }
+ XCTAssert(dtm == 17)
+
+ var found = false
+ guard let moves = tablebaseLookup.moves else {
+ XCTAssert(true == false)
+ return
+ }
+ for move in moves {
+ guard let uci = move.uci else {
+ XCTAssert(false == true)
+ return
+ }
+ if uci == "h7h8q" {
+ found = true
+ break
+ }
+ }
+ XCTAssert(found == true)
+ }
+}