MCPcopy
hub / github.com/TarsCloud/TarsGo / TestBuffer_Reset

Function TestBuffer_Reset

tars/protocol/codec/codec_test.go:328–342  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

326}
327
328func TestBuffer_Reset(t *testing.T) {
329 got := NewBuffer()
330 err := got.WriteBytes([]byte("test"))
331 if err != nil {
332 t.Errorf("Write bytes failed")
333 }
334 got.Reset()
335
336 want := NewBuffer()
337
338 if want.buf.String() != got.buf.String() || want.buf.Len() != got.buf.Len() {
339 t.Errorf("Test Reset failed. want:'%v', len=%v got:'%v', len=%v\n",
340 want.buf.String(), want.buf.Len(), got.buf.String(), got.buf.Len())
341 }
342}
343
344func TestBuffer_slice_uint8(t *testing.T) {
345 var want = []uint8{1, 2, 3, 4, 5}

Callers

nothing calls this directly

Calls 6

WriteBytesMethod · 0.95
ResetMethod · 0.95
NewBufferFunction · 0.85
ErrorfMethod · 0.45
StringMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected