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

Function TestLinkBufferCheckSingleNode

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

Source from the content-addressed store, hash-verified

430}
431
432func TestLinkBufferCheckSingleNode(t *testing.T) {
433 buf := NewLinkBuffer(block4k)
434 _, err := buf.Malloc(block8k)
435 MustNil(t, err)
436 buf.Flush()
437 MustTrue(t, buf.read.Len() == 0)
438 is := buf.isSingleNode(block8k)
439 MustTrue(t, is)
440 MustTrue(t, buf.read.Len() == block8k)
441 is = buf.isSingleNode(block8k + 1)
442 MustTrue(t, !is)
443
444 // cross node malloc, but b.read.Len() still == 0
445 buf = NewLinkBuffer(block4k)
446 _, err = buf.Malloc(block8k)
447 MustNil(t, err)
448 // not malloc ack yet
449 // read function will call isSingleNode inside
450 buf.isSingleNode(1)
451}
452
453func TestLinkBufferWriteMultiFlush(t *testing.T) {
454 buf := NewLinkBuffer()

Callers

nothing calls this directly

Calls 7

NewLinkBufferFunction · 0.85
isSingleNodeMethod · 0.80
MallocMethod · 0.65
FlushMethod · 0.65
LenMethod · 0.65
MustNilFunction · 0.50
MustTrueFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…