MCPcopy Create free account
hub / github.com/segmentio/encoding / TestEncodeDecodeTag

Function TestEncodeDecodeTag

proto/proto_test.go:52–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestEncodeDecodeTag(t *testing.T) {
53 b := [8]byte{}
54
55 n, err := encodeTag(b[:], 1, varint)
56 if err != nil {
57 t.Fatal(err)
58 }
59
60 num, typ, n2, err := decodeTag(b[:n])
61 if err != nil {
62 t.Fatal(err)
63 }
64 if num != 1 {
65 t.Errorf("decoded field number mismatch: want %d, got %d", 1, num)
66 }
67 if typ != varint {
68 t.Errorf("decoded wire type mismatch: want %d, got %d", varint, typ)
69 }
70 if n2 != n {
71 t.Errorf("decoded byte count mismatch: want %d, got %d", n, n2)
72 }
73}
74
75type key struct {
76 Hi uint64

Callers

nothing calls this directly

Calls 2

encodeTagFunction · 0.85
decodeTagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…