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

Function TestLengthFromPoints

earth/earth_test.go:69–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestLengthFromPoints(t *testing.T) {
70 tests := []struct {
71 x1, y1, z1 float64
72 x2, y2, z2 float64
73 length unit.Length
74 }{
75 {1, 0, 0, 1, 0, 0, 0 * unit.Meter},
76 {1, 0, 0, 0, 1, 0, 10007559.105973555 * unit.Meter},
77 {1, 0, 0, 0, 1, 1, 10007559.105973555 * unit.Meter},
78 {1, 0, 0, -1, 0, 0, 20015118.21194711 * unit.Meter},
79 {1, 2, 3, 2, 3, -1, 7680820.247060414 * unit.Meter},
80 }
81 for _, test := range tests {
82 p1 := s2.PointFromCoords(test.x1, test.y1, test.z1)
83 p2 := s2.PointFromCoords(test.x2, test.y2, test.z2)
84 if got, want := LengthFromPoints(p1, p2), test.length; !float64Eq(got.Meters(), want.Meters()) {
85 t.Errorf("LengthFromPoints(%v, %v) = %v, want %v", p1, p2, got, want)
86 }
87 }
88}
89
90func TestLengthFromLatLngs(t *testing.T) {
91 tests := []struct {

Callers

nothing calls this directly

Calls 3

PointFromCoordsFunction · 0.92
LengthFromPointsFunction · 0.85
float64EqFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…