MCPcopy
hub / github.com/deepflowio/deepflow / TestByteBufferUseTwice

Function TestByteBufferUseTwice

server/libs/utils/byte_buffer_test.go:31–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestByteBufferUseTwice(t *testing.T) {
32 bytes := &ByteBuffer{quota: 10}
33 buf := bytes.Use(10)
34 if len(buf) != 10 || len(bytes.Bytes()) != 10 {
35 t.Error("第一次调用Use函数处理不正确")
36 }
37 bytes.SetQuota(30)
38 buf = bytes.Use(20)
39 if len(buf) != 20 || len(bytes.Bytes()) != 30 {
40 t.Error("第二次调用Use函数处理不正确")
41 }
42}
43
44func TestByteBufferReset(t *testing.T) {
45 bytes := &ByteBuffer{quota: 10}

Callers

nothing calls this directly

Calls 4

UseMethod · 0.95
BytesMethod · 0.95
SetQuotaMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected