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

Function TestEncodePackedSInt64

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

Source from the content-addressed store, hash-verified

473}
474
475func TestEncodePackedSInt64(t *testing.T) {
476 dest := make([]byte, 19)
477 enc := csproto.NewEncoder(dest)
478 enc.EncodePackedSInt64(1, []int64{0, math.MaxInt64, 421138, -421138})
479
480 expected := []byte{
481 // tag=1, wire type=2
482 0x0a,
483 // total length (17)
484 0x11,
485 // 0,
486 0x00,
487 // math.MaxInt64
488 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
489 // 421138
490 0xA4, 0xB4, 0x33,
491 // -421138
492 0xA3, 0xB4, 0x33,
493 }
494 assert.Equal(t, expected, dest)
495}
496
497func TestEncodeFixed32(t *testing.T) {
498 cases := []struct {

Callers

nothing calls this directly

Calls 2

EncodePackedSInt64Method · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected