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

Function TestLoopEncodeDecode

s2/encode_test.go:295–310  ·  view source on GitHub ↗

Captures the uncompressed path.

(t *testing.T)

Source from the content-addressed store, hash-verified

293
294// Captures the uncompressed path.
295func TestLoopEncodeDecode(t *testing.T) {
296 pts := parsePoints("30:20, 40:20, 39:43, 33:35")
297 loops := []*Loop{LoopFromPoints(pts), EmptyLoop(), FullLoop()}
298 for i, l := range loops {
299 var buf bytes.Buffer
300 l.Encode(&buf)
301 ll := new(Loop)
302 if err := ll.Decode(&buf); err != nil {
303 t.Errorf("Decode %d: %v", i, err)
304 continue
305 }
306 if !reflect.DeepEqual(l, ll) {
307 t.Errorf("encoding roundtrip failed")
308 }
309 }
310}
311
312func TestLoopEncodeDecodeFuzzed(t *testing.T) {
313 for i := 3; i < 100; i++ {

Callers

nothing calls this directly

Calls 6

parsePointsFunction · 0.85
LoopFromPointsFunction · 0.85
EmptyLoopFunction · 0.85
FullLoopFunction · 0.85
EncodeMethod · 0.65
DecodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…