MCPcopy Create free account
hub / github.com/CrowdStrike/csproto / TestEncodePackedUInt64

Function TestEncodePackedUInt64

encoder_test.go:339–357  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

337}
338
339func TestEncodePackedUInt64(t *testing.T) {
340 dest := make([]byte, 16)
341 enc := csproto.NewEncoder(dest)
342 enc.EncodePackedUInt64(1, []uint64{0, math.MaxUint64, 421138})
343
344 expected := []byte{
345 // tag=1, wire type=2
346 0x0a,
347 // total length (14)
348 0x0E,
349 // 0,
350 0x00,
351 // math.MaxUint64
352 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1,
353 // 421138
354 0x92, 0xDA, 0x19,
355 }
356 assert.Equal(t, expected, dest)
357}
358
359func TestEncodeSInt32(t *testing.T) {
360 cases := []struct {

Callers

nothing calls this directly

Calls 2

EncodePackedUInt64Method · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected