MCPcopy
hub / github.com/awnumar/memguard / TestReader

Function TestReader

buffer_test.go:879–897  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

877}
878
879func TestReader(t *testing.T) {
880 b := NewBufferRandom(32)
881 c, err := NewBufferFromReader(b.Reader(), 32)
882 if err != nil {
883 t.Error(err)
884 }
885 if !bytes.Equal(b.Bytes(), c.Bytes()) {
886 t.Error("data not equal")
887 }
888 b.Destroy()
889 c.Destroy()
890 if c.Reader().Size() != 0 {
891 t.Error("expected nul reader")
892 }
893 b = newNullBuffer()
894 if c.Reader().Size() != 0 {
895 t.Error("expected nul reader")
896 }
897}
898
899func TestString(t *testing.T) {
900 b := NewBufferRandom(32)

Callers

nothing calls this directly

Calls 7

NewBufferRandomFunction · 0.85
NewBufferFromReaderFunction · 0.85
newNullBufferFunction · 0.85
ReaderMethod · 0.80
BytesMethod · 0.80
DestroyMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…