(t *testing.T)
| 175 | doOne(array[:0]) // edge case of zero length |
| 176 | } |
| 177 | func TestAppendUints32(t *testing.T) { |
| 178 | doOne := func(vals []uint32) { |
| 179 | want := make([]byte, 0) |
| 180 | want = append(want, '[') |
| 181 | for i, val := range vals { |
| 182 | want = append(want, []byte(fmt.Sprintf("%d", uint32(val)))...) |
| 183 | if i < len(vals)-1 { |
| 184 | want = append(want, ',') |
| 185 | } |
| 186 | } |
| 187 | want = append(want, ']') |
| 188 | |
| 189 | got := enc.AppendUints32([]byte{}, vals) |
| 190 | if !bytes.Equal(got, want) { |
| 191 | t.Errorf("AppendUints32(%v)\ngot: %s\nwant: %s", |
| 192 | vals, |
| 193 | string(got), |
| 194 | string(want)) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | array := make([]uint32, 0) |
| 199 | for _, tc := range internal.UnsignedIntegerTestCases { |
| 200 | if tc.Val > math.MaxUint32 { |
| 201 | continue |
| 202 | } |
| 203 | array = append(array, uint32(tc.Val)) |
| 204 | } |
| 205 | |
| 206 | doOne(array) |
| 207 | doOne(array[:1]) // single element |
| 208 | doOne(array[:0]) // edge case of zero length |
| 209 | } |
| 210 | |
| 211 | func TestAppendInt64(t *testing.T) { |
| 212 | doOne := func(vals []int64) { |
nothing calls this directly
no test coverage detected