MCPcopy Index your code
hub / github.com/tinylib/msgp / TestReadBoolBytes

Function TestReadBoolBytes

msgp/read_bytes_test.go:230–253  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

228}
229
230func TestReadBoolBytes(t *testing.T) {
231 var buf bytes.Buffer
232 en := NewWriter(&buf)
233
234 tests := []bool{true, false}
235
236 for i, v := range tests {
237 buf.Reset()
238 en.WriteBool(v)
239 en.Flush()
240 out, left, err := ReadBoolBytes(buf.Bytes())
241 if err != nil {
242 t.Errorf("test case %d: %s", i, err)
243 }
244
245 if len(left) != 0 {
246 t.Errorf("expected 0 bytes left; found %d", len(left))
247 }
248
249 if out != v {
250 t.Errorf("%t in; %t out", v, out)
251 }
252 }
253}
254
255func BenchmarkReadBoolBytes(b *testing.B) {
256 buf := []byte{mtrue, mfalse, mtrue, mfalse}

Callers

nothing calls this directly

Calls 5

WriteBoolMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
ReadBoolBytesFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…