MCPcopy Create free account
hub / github.com/cloudwego/netpoll / TestLinkBufferResetTail

Function TestLinkBufferResetTail

nocopy_linkbuffer_test.go:395–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

393}
394
395func TestLinkBufferResetTail(t *testing.T) {
396 except := byte(1)
397
398 LinkBufferCap = 8
399 buf := NewLinkBuffer()
400
401 // 1. slice reader
402 buf.WriteByte(except)
403 buf.Flush()
404 r1, _ := buf.Slice(1)
405 t.Logf("1: %x\n", buf.flush.buf)
406 // 2. release & reset tail
407 buf.resetTail(LinkBufferCap)
408 buf.WriteByte(byte(2))
409 t.Logf("2: %x\n", buf.flush.buf)
410
411 // check slice reader
412 got, _ := r1.ReadByte()
413 Equal(t, got, except)
414}
415
416func TestLinkBufferWriteBuffer(t *testing.T) {
417 buf1 := NewLinkBuffer()

Callers

nothing calls this directly

Calls 7

NewLinkBufferFunction · 0.85
WriteByteMethod · 0.65
FlushMethod · 0.65
SliceMethod · 0.65
ReadByteMethod · 0.65
EqualFunction · 0.50
resetTailMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…