(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func 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 | |
| 90 | func TestLengthFromLatLngs(t *testing.T) { |
| 91 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…