(t *testing.T)
| 83 | } |
| 84 | |
| 85 | func TestReadMapStringInt32(t *testing.T) { |
| 86 | testCases := map[string]struct { |
| 87 | Data map[string][]int32 |
| 88 | }{ |
| 89 | "empty": { |
| 90 | Data: map[string][]int32{}, |
| 91 | }, |
| 92 | "single element": { |
| 93 | Data: map[string][]int32{ |
| 94 | "key": {0, 1, 2}, |
| 95 | }, |
| 96 | }, |
| 97 | } |
| 98 | |
| 99 | for label, test := range testCases { |
| 100 | t.Run(label, func(t *testing.T) { |
| 101 | b := bytes.NewBuffer(nil) |
| 102 | w := &writeBuffer{w: b} |
| 103 | w.writeInt32(int32(len(test.Data))) |
| 104 | |
| 105 | for key, values := range test.Data { |
| 106 | w.writeString(key) |
| 107 | w.writeInt32Array(values) |
| 108 | } |
| 109 | |
| 110 | var actual map[string][]int32 |
| 111 | readMapStringInt32(bufio.NewReader(b), b.Len(), &actual) |
| 112 | if !reflect.DeepEqual(test.Data, actual) { |
| 113 | t.Errorf("expected %#v; got %#v", test.Data, actual) |
| 114 | } |
| 115 | }) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestReadNewBytes(t *testing.T) { |
| 120 |
nothing calls this directly
no test coverage detected