Skip to content

Commit 35ab489

Browse files
authored
edge_distances: fix test (golang#106)
The fixture for TestEdgeDistancesUpdateMinInteriorDistanceRejectionTestIsConservative is confusing; it seems to 'want' `false` but actually it is being ignored and the test is expecting `true`. Use `want` and change the value to `true`. This agrees with C++: https://github.com/google/s2geometry/blob/58de4ea1e2f8a294e0c072c602c22232fd1433ad/src/s2/s2edge_distances_test.cc#L204
1 parent 45267f9 commit 35ab489

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

s2/edge_distances_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,26 @@ func TestEdgeDistancesUpdateMinInteriorDistanceRejectionTestIsConservative(t *te
202202
a: Point{r3.Vector{X: 1, Y: -8.9031850507928352e-11, Z: 0}},
203203
b: Point{r3.Vector{X: -0.99999999999996347, Y: 2.7030110029169596e-07, Z: 1.555092348806121e-99}},
204204
minDist: minDist,
205-
want: false,
205+
want: true,
206206
},
207207
{
208208
x: Point{r3.Vector{X: 1, Y: -4.7617930898495072e-13, Z: 0}},
209209
a: Point{r3.Vector{X: -1, Y: -1.6065916409055676e-10, Z: 0}},
210210
b: Point{r3.Vector{X: 1, Y: 0, Z: 9.9964883247706732e-35}},
211211
minDist: minDist,
212-
want: false,
212+
want: true,
213213
},
214214
{
215215
x: Point{r3.Vector{X: 1, Y: 0, Z: 0}},
216216
a: Point{r3.Vector{X: 1, Y: -8.4965026896454536e-11, Z: 0}},
217217
b: Point{r3.Vector{X: -0.99999999999966138, Y: 8.2297529603339328e-07, Z: 9.6070344113320997e-21}},
218218
minDist: minDist,
219-
want: false,
219+
want: true,
220220
},
221221
}
222222

223223
for _, test := range tests {
224-
if _, ok := UpdateMinDistance(test.x, test.a, test.b, test.minDist); !ok {
224+
if _, ok := UpdateMinDistance(test.x, test.a, test.b, test.minDist); ok != test.want {
225225
t.Errorf("UpdateMinDistance(%v, %v, %v, %v) = %v, want %v", test.x, test.a, test.b, test.minDist, ok, test.want)
226226
}
227227
}

0 commit comments

Comments
 (0)