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

Function TestCellIDFromString

s2/cellid_test.go:147–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

145}
146
147func TestCellIDFromString(t *testing.T) {
148 tests := []struct {
149 have string
150 want CellID
151 }{
152 {have: "3/", want: CellIDFromFace(3)},
153 {have: "0/21", want: CellIDFromFace(0).Children()[2].Children()[1]},
154 {have: "4/000000000000000000000000000000", want: CellIDFromFace(4).RangeMin()},
155 {have: "4/0000000000000000000000000000000", want: 0},
156 {have: "", want: 0},
157 {have: "7/", want: 0},
158 {have: " /", want: 0},
159 {have: "3:0", want: 0},
160 {have: "3/ 12", want: 0},
161 {have: "3/1241", want: 0},
162 }
163
164 for _, test := range tests {
165 if got := CellIDFromString(test.have); got != test.want {
166 t.Errorf("CellIDFromString(%q) = %v, want %v", test.have, got, test.want)
167 }
168 }
169}
170
171func TestCellIDLatLng(t *testing.T) {
172 // You can generate these with the s2cellid2latlngtestcase C++ program in this directory.

Callers

nothing calls this directly

Calls 4

CellIDFromFaceFunction · 0.85
CellIDFromStringFunction · 0.85
RangeMinMethod · 0.80
ChildrenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…