MCPcopy
hub / github.com/golang/geo / TestClosestEdgeQueryNoEdges

Function TestClosestEdgeQueryNoEdges

s2/edge_query_closest_test.go:25–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestClosestEdgeQueryNoEdges(t *testing.T) {
26 index := &ShapeIndex{}
27 query := NewClosestEdgeQuery(index, nil)
28 target := NewMinDistanceToPointTarget(PointFromCoords(1, 0, 0))
29 edge := query.findEdge(target, query.opts)
30
31 if edge.shapeID != -1 {
32 t.Errorf("shapeID for empty index should be -1, got %v", edge.shapeID)
33 }
34 if edge.edgeID != -1 {
35 t.Errorf("edgeID for empty index should be -1, got %v", edge.edgeID)
36 }
37 if got, want := edge.Distance(), s1.InfChordAngle(); got != want {
38 t.Errorf("edge.Distance = %+v, want %+v", got, want)
39 }
40
41 if got, want := query.Distance(target), s1.InfChordAngle(); got != want {
42 t.Errorf("query.Distance(%v) = %+v, want %+v", target, got, want)
43 }
44}
45
46func TestClosestEdgeQueryBasicTest(t *testing.T) {
47 index := makeShapeIndex("1:1 | 1:2 | 1:3 # #")

Callers

nothing calls this directly

Calls 6

InfChordAngleFunction · 0.92
NewClosestEdgeQueryFunction · 0.85
PointFromCoordsFunction · 0.85
findEdgeMethod · 0.80
DistanceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…