(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func TestEncodeBytes(t *testing.T) { |
| 87 | cases := []struct { |
| 88 | name string |
| 89 | fieldNum int |
| 90 | v []byte |
| 91 | expected []byte |
| 92 | }{ |
| 93 | { |
| 94 | name: "empty slice", |
| 95 | fieldNum: 1, |
| 96 | v: []byte{}, |
| 97 | expected: []byte{0xA, 0x0}, |
| 98 | }, |
| 99 | { |
| 100 | name: "non-empty slice", |
| 101 | fieldNum: 2, |
| 102 | v: []byte{0x42, 0x11, 0x38}, |
| 103 | expected: []byte{0x12, 0x3, 0x42, 0x11, 0x38}, |
| 104 | }, |
| 105 | } |
| 106 | for _, tc := range cases { |
| 107 | t.Run(tc.name, func(t *testing.T) { |
| 108 | dest := make([]byte, len(tc.expected)) |
| 109 | csproto.NewEncoder(dest).EncodeBytes(tc.fieldNum, tc.v) |
| 110 | assert.Equal(t, tc.expected, dest) |
| 111 | }) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | func TestEncodeInt32(t *testing.T) { |
| 116 | cases := []struct { |
nothing calls this directly
no test coverage detected