Test point->index conversion
This commit is contained in:
parent
045842c20a
commit
e50a36f7d1
1 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,13 @@ class DiamondSquareAlgorithmTests: XCTestCase {
|
||||||
DiamondSquareAlgorithm.Algorithm(grid: grid)
|
DiamondSquareAlgorithm.Algorithm(grid: grid)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
func testPointToIndexConversion() {
|
||||||
|
let idx = alg.convert(pointToIndex: Point(x: 2, y: 2))
|
||||||
|
XCTAssertEqual(idx, 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Diamond Corners
|
||||||
|
|
||||||
func testDiamondCornersNorth() {
|
func testDiamondCornersNorth() {
|
||||||
let corners = alg.diamondCorners(forPoint: Point(x: 2, y: 0), diamondSize: grid.size)
|
let corners = alg.diamondCorners(forPoint: Point(x: 2, y: 0), diamondSize: grid.size)
|
||||||
XCTAssertEqual(corners.count, 4)
|
XCTAssertEqual(corners.count, 4)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue