Skip to content

Commit 44db4ea

Browse files
committed
update test project and fix tests after reverting some previous work
1 parent 100817c commit 44db4ea

File tree

8 files changed

+341
-332
lines changed

8 files changed

+341
-332
lines changed

Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
2-
- FastMath (1.0.0)
3-
- FastMath/Tests (1.0.0)
2+
- FastMath (2.1.0)
3+
- FastMath/Tests (2.1.0)
44

55
DEPENDENCIES:
66
- FastMath (from `.`)
@@ -11,7 +11,7 @@ EXTERNAL SOURCES:
1111
:path: "."
1212

1313
SPEC CHECKSUMS:
14-
FastMath: 9fb236a4826c1c81e1778710231aeadf9bc2e68c
14+
FastMath: 4a027b860bce7c9c24b3c006132334f9ecbe6a8e
1515

1616
PODFILE CHECKSUM: 64e764c91bdef09f2edbb8639d1b38e3d5b11610
1717

Pods/Local Podspecs/FastMath.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Manifest.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 320 additions & 280 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/xcshareddata/xcschemes/FastMath-Unit-Tests.xcscheme

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/xcshareddata/xcschemes/FastMath.xcscheme

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/FastMath/Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tests/DelaunayTriangulationTests.swift

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DelaunayTriangulationTests: XCTestCase {
5252
parent.children = [tri1, tri2]
5353
let expected = parent.getTriangles()
5454

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

9292
let points = expected.points()
9393

94-
let triangulator = DelaunayTriangulator(points: points)
95-
guard let computed = triangulator.triangulation?.getTriangles() else {
94+
let triangulator = DelaunayTriangulator()
95+
let triangulation = triangulator.triangulate(points: Set(points))
96+
guard let computed = triangulation?.getTriangles() else {
9697
XCTFail("No triangles returned from triangulation.")
9798
return
9899
}
@@ -104,35 +105,16 @@ class DelaunayTriangulationTests: XCTestCase {
104105
FastMath.logBlock = { message in
105106
print(message)
106107
}
107-
for (points, expected) in [/*caseA, caseB, */caseC] {
108-
let triangulator = DelaunayTriangulator(points: Set(points))
109-
guard let triangles = triangulator.triangulation?.getTriangles() else {
108+
for (points, expected) in [caseA, caseB] {
109+
let triangulator = DelaunayTriangulator()
110+
let triangulation = triangulator.triangulate(points: Set(points))
111+
guard let triangles = triangulation?.getTriangles() else {
110112
XCTFail("No triangles returned from triangulation.")
111113
return
112114
}
113115
XCTAssertEqual(expected, triangles)
114116
}
115117
}
116-
117-
func testIterativeTriangulation() {
118-
FastMath.logBlock = { message in
119-
print(message)
120-
}
121-
for (points, expected) in [/*caseA, caseB, */caseC] {
122-
let triangulator = DelaunayTriangulator(points: Set([]))
123-
for point in points {
124-
triangulator.insertPoint(point: point)
125-
}
126-
guard let triangles = triangulator.triangulation?.getTriangles() else {
127-
XCTFail("No triangles returned from triangulation.")
128-
return
129-
}
130-
131-
print(triangles.generatingCode())
132-
133-
XCTAssertEqual(expected, triangles)
134-
}
135-
}
136118
}
137119

138120
extension DelaunayTriangulationTests {
@@ -177,17 +159,4 @@ extension DelaunayTriangulationTests {
177159

178160
return (input, expected)
179161
}
180-
181-
var caseC: TestCase {
182-
let input = Array([
183-
Vertex(x: 168.5, y: 778.5, name: "a"),
184-
Vertex(x: 272.0, y: 295.5, name: "b"),
185-
Vertex(x: 602.0, y: 501.5, name: "c"),
186-
Vertex(x: 426.0, y: 880.5, name: "d"),
187-
])
188-
189-
let expected = Set<Triangle>([])
190-
191-
return (input, expected)
192-
}
193162
}

0 commit comments

Comments
 (0)