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

Function TestEncodePackedUInt32

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

Source from the content-addressed store, hash-verified

282}
283
284func TestEncodePackedUInt32(t *testing.T) {
285 dest := make([]byte, 9)
286 enc := csproto.NewEncoder(dest)
287 enc.EncodePackedUInt32(1, []uint32{0, math.MaxUint32, 42})
288
289 expected := []byte{
290 // tag=1, wire type=2
291 0x0a,
292 // total length (7)
293 0x07,
294 // 0,
295 0x00,
296 // math.MaxUint32
297 0xFF, 0xFF, 0xFF, 0xFF, 0x0F,
298 // 42
299 0x2A,
300 }
301 assert.Equal(t, expected, dest)
302}
303
304func TestEncodeUInt64(t *testing.T) {
305 cases := []struct {

Callers

nothing calls this directly

Calls 2

EncodePackedUInt32Method · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected