| 382 | func BenchmarkAppend2048String(b *testing.B) { benchappendString(2048, b) } |
| 383 | |
| 384 | func TestAppendBool(t *testing.T) { |
| 385 | vs := []bool{true, false} |
| 386 | var buf bytes.Buffer |
| 387 | en := NewWriter(&buf) |
| 388 | var bts []byte |
| 389 | |
| 390 | for _, v := range vs { |
| 391 | buf.Reset() |
| 392 | en.WriteBool(v) |
| 393 | en.Flush() |
| 394 | bts = AppendBool(bts[0:0], v) |
| 395 | if !bytes.Equal(buf.Bytes(), bts) { |
| 396 | t.Errorf("for %t, encoder wrote %q and append wrote %q", v, buf.Bytes(), bts) |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | func BenchmarkAppendBool(b *testing.B) { |
| 402 | vs := []bool{true, false} |