(t *testing.T)
| 239 | doOne(array[:0]) // edge case of zero length |
| 240 | } |
| 241 | func TestAppendUints64(t *testing.T) { |
| 242 | doOne := func(vals []uint64) { |
| 243 | want := make([]byte, 0) |
| 244 | want = append(want, '[') |
| 245 | for i, val := range vals { |
| 246 | want = append(want, []byte(fmt.Sprintf("%d", uint64(val)))...) |
| 247 | if i < len(vals)-1 { |
| 248 | want = append(want, ',') |
| 249 | } |
| 250 | } |
| 251 | want = append(want, ']') |
| 252 | |
| 253 | got := enc.AppendUints64([]byte{}, vals) |
| 254 | if !bytes.Equal(got, want) { |
| 255 | t.Errorf("AppendUints64(%v)\ngot: %s\nwant: %s", |
| 256 | vals, |
| 257 | string(got), |
| 258 | string(want)) |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | array := make([]uint64, 0) |
| 263 | for _, tc := range internal.UnsignedIntegerTestCases { |
| 264 | array = append(array, uint64(tc.Val)) |
| 265 | } |
| 266 | |
| 267 | doOne(array) |
| 268 | doOne(array[:1]) // single element |
| 269 | doOne(array[:0]) // edge case of zero length |
| 270 | } |
| 271 | |
| 272 | func TestAppendInt(t *testing.T) { |
| 273 | for _, tc := range internal.IntegerTestCases { |
nothing calls this directly
no test coverage detected