From a960f6f39043fb8cf73617814907e8854701cc8b Mon Sep 17 00:00:00 2001 From: Mathieu GROUSSEAU Date: Tue, 21 Jan 2025 20:01:07 +0100 Subject: [PATCH] Change misleading label --- Model/Sources/Model/Board.swift | 4 ++-- Model/Tests/ModelTests/EmptyBoardTests.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Model/Sources/Model/Board.swift b/Model/Sources/Model/Board.swift index c545aae..f9c6155 100644 --- a/Model/Sources/Model/Board.swift +++ b/Model/Sources/Model/Board.swift @@ -61,10 +61,10 @@ public struct Board { // insertion coordinate computation is intentionally separated from actual insertion because the user may want to // display a where the piece would end-up before doing the actual insertion - public func getInsertionCoordinates(direction: Direction, offset: Int) -> Coords { + public func getInsertionCoordinates(from: Direction, offset: Int) -> Coords { precondition(offset >= 0, "Offset out of bounds") - switch direction { + switch from { case .Top: precondition(offset < self.columns, "Offset (column) out of bounds") return Coords(offset, 0) diff --git a/Model/Tests/ModelTests/EmptyBoardTests.swift b/Model/Tests/ModelTests/EmptyBoardTests.swift index 63b285b..476fa85 100644 --- a/Model/Tests/ModelTests/EmptyBoardTests.swift +++ b/Model/Tests/ModelTests/EmptyBoardTests.swift @@ -79,7 +79,7 @@ final class EmptyBoardTests: XCTestCase { } private func _testInsertSide(side: Direction, offset: Int, expectedCoords: Coords) throws { - let result = board.getInsertionCoordinates(direction: side, offset: offset) + let result = board.getInsertionCoordinates(from: side, offset: offset) // Note: Not sure I want Coordinates to be a simple tuple or a struct, as both have advantages that the other dont: // Tuples can be initialized like so (col, row) which I find quite handy