MCPcopy
hub / github.com/tinylib/msgp / TestAppendBool

Function TestAppendBool

msgp/write_bytes_test.go:384–399  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

382func BenchmarkAppend2048String(b *testing.B) { benchappendString(2048, b) }
383
384func 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
401func BenchmarkAppendBool(b *testing.B) {
402 vs := []bool{true, false}

Callers

nothing calls this directly

Calls 6

WriteBoolMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
AppendBoolFunction · 0.85
ResetMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…