Test + bug fixes

This commit is contained in:
cdricms
2024-06-26 01:07:03 +02:00
parent 0ea0ec1bc6
commit 78a4737015
5 changed files with 100 additions and 104 deletions

View File

@@ -6,6 +6,17 @@ final class EngineTests: XCTestCase {
override func setUp() {
super.setUp()
}
func testPositionIndex() throws {
var rank = 9
for i in 0..<64 {
let file = (i % 8) + 1
if file - 1 == 0 {
rank -= 1
}
let pos: Square.Position = .init(file: UInt8(file), rank: UInt8(rank))
XCTAssertTrue(pos.index == i, "Expected \(i) got \(pos.index)")
}
}
// func testBoard() throws {
// let board = Board()
// }