MCPcopy Create free account
hub / github.com/djherbis/buffer / simple

Function simple

buffer_test.go:502–523  ·  view source on GitHub ↗
(t *testing.T, buf Buffer)

Source from the content-addressed store, hash-verified

500}
501
502func simple(t *testing.T, buf Buffer) {
503 buf.Write([]byte("hello world"))
504 data, err := ioutil.ReadAll(buf)
505 if err != nil {
506 t.Error(err.Error())
507 }
508 if !bytes.Equal([]byte("hello world"), data) {
509 t.Error("Hello world failed.")
510 }
511
512 buf.Write([]byte("hello world"))
513 data = make([]byte, 3)
514 buf.Read(data)
515 buf.Write([]byte(" yolo"))
516 data, err = ioutil.ReadAll(buf)
517 if err != nil {
518 t.Error(err.Error())
519 }
520 if !bytes.Equal([]byte("lo world yolo"), data) {
521 t.Error("Buffer crossing error :(", string(data))
522 }
523}
524
525func buildOutputs(t *testing.T, buf Buffer, size int64) (wrote []byte, read []byte) {
526 r := io.LimitReader(rand.Reader, size)

Callers 1

runPerfectSeriesFunction · 0.85

Calls 2

WriteMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…