Skip to content

Commit

Permalink
update test project and fix tests after reverting some previous work
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Sep 23, 2018
1 parent 100817c commit 44db4ea
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 332 deletions.
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- FastMath (1.0.0)
- FastMath/Tests (1.0.0)
- FastMath (2.1.0)
- FastMath/Tests (2.1.0)

DEPENDENCIES:
- FastMath (from `.`)
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: "."

SPEC CHECKSUMS:
FastMath: 9fb236a4826c1c81e1778710231aeadf9bc2e68c
FastMath: 4a027b860bce7c9c24b3c006132334f9ecbe6a8e

PODFILE CHECKSUM: 64e764c91bdef09f2edbb8639d1b38e3d5b11610

Expand Down
4 changes: 2 additions & 2 deletions Pods/Local Podspecs/FastMath.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

600 changes: 320 additions & 280 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Pods/Pods.xcodeproj/xcshareddata/xcschemes/FastMath.xcscheme

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/Target Support Files/FastMath/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 8 additions & 39 deletions Tests/DelaunayTriangulationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DelaunayTriangulationTests: XCTestCase {
parent.children = [tri1, tri2]
let expected = parent.getTriangles()

guard let computed = DelaunayTriangulator(points: points).triangulation?.getTriangles() else {
guard let computed = DelaunayTriangulator().triangulate(points: Set(points))?.getTriangles() else {
XCTFail("No triangles returned from triangulation.")
return
}
Expand Down Expand Up @@ -91,8 +91,9 @@ class DelaunayTriangulationTests: XCTestCase {

let points = expected.points()

let triangulator = DelaunayTriangulator(points: points)
guard let computed = triangulator.triangulation?.getTriangles() else {
let triangulator = DelaunayTriangulator()
let triangulation = triangulator.triangulate(points: Set(points))
guard let computed = triangulation?.getTriangles() else {
XCTFail("No triangles returned from triangulation.")
return
}
Expand All @@ -104,35 +105,16 @@ class DelaunayTriangulationTests: XCTestCase {
FastMath.logBlock = { message in
print(message)
}
for (points, expected) in [/*caseA, caseB, */caseC] {
let triangulator = DelaunayTriangulator(points: Set(points))
guard let triangles = triangulator.triangulation?.getTriangles() else {
for (points, expected) in [caseA, caseB] {
let triangulator = DelaunayTriangulator()
let triangulation = triangulator.triangulate(points: Set(points))
guard let triangles = triangulation?.getTriangles() else {
XCTFail("No triangles returned from triangulation.")
return
}
XCTAssertEqual(expected, triangles)
}
}

func testIterativeTriangulation() {
FastMath.logBlock = { message in
print(message)
}
for (points, expected) in [/*caseA, caseB, */caseC] {
let triangulator = DelaunayTriangulator(points: Set([]))
for point in points {
triangulator.insertPoint(point: point)
}
guard let triangles = triangulator.triangulation?.getTriangles() else {
XCTFail("No triangles returned from triangulation.")
return
}

print(triangles.generatingCode())

XCTAssertEqual(expected, triangles)
}
}
}

extension DelaunayTriangulationTests {
Expand Down Expand Up @@ -177,17 +159,4 @@ extension DelaunayTriangulationTests {

return (input, expected)
}

var caseC: TestCase {
let input = Array([
Vertex(x: 168.5, y: 778.5, name: "a"),
Vertex(x: 272.0, y: 295.5, name: "b"),
Vertex(x: 602.0, y: 501.5, name: "c"),
Vertex(x: 426.0, y: 880.5, name: "d"),
])

let expected = Set<Triangle>([])

return (input, expected)
}
}

0 comments on commit 44db4ea

Please sign in to comment.