(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestEncodeBool(t *testing.T) { |
| 13 | cases := []struct { |
| 14 | name string |
| 15 | fieldNum int |
| 16 | v bool |
| 17 | expected []byte |
| 18 | }{ |
| 19 | { |
| 20 | name: "true value", |
| 21 | fieldNum: 1, |
| 22 | v: true, |
| 23 | expected: []byte{0x8, 0x1}, |
| 24 | }, |
| 25 | { |
| 26 | name: "false value", |
| 27 | fieldNum: 2, |
| 28 | v: false, |
| 29 | expected: []byte{0x10, 0x0}, |
| 30 | }, |
| 31 | } |
| 32 | for _, tc := range cases { |
| 33 | t.Run(tc.name, func(t *testing.T) { |
| 34 | dest := make([]byte, len(tc.expected)) |
| 35 | csproto.NewEncoder(dest).EncodeBool(tc.fieldNum, tc.v) |
| 36 | assert.Equal(t, tc.expected, dest) |
| 37 | }) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func TestEncodePackedBool(t *testing.T) { |
| 42 | dest := make([]byte, 5) |
nothing calls this directly
no test coverage detected