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

Function TestEncodePackedInt64

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

Source from the content-addressed store, hash-verified

227}
228
229func TestEncodePackedInt64(t *testing.T) {
230 dest := make([]byte, 15)
231 enc := csproto.NewEncoder(dest)
232 enc.EncodePackedInt64(1, []int64{0, math.MaxInt64, 421138})
233
234 expected := []byte{
235 // tag=1, wire type=2
236 0x0a,
237 // total length (13)
238 0x0D,
239 // 0,
240 0x00,
241 // math.MaxInt64
242 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F,
243 // 421138
244 0x92, 0xDA, 0x19,
245 }
246 assert.Equal(t, expected, dest)
247}
248
249func TestEncodeUInt32(t *testing.T) {
250 cases := []struct {

Callers

nothing calls this directly

Calls 2

EncodePackedInt64Method · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected