github.com/lingyao2333/mo-zero@v1.4.1/core/iox/bufferpool_test.go (about)

     1  package iox
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestBufferPool(t *testing.T) {
    11  	capacity := 1024
    12  	pool := NewBufferPool(capacity)
    13  	pool.Put(bytes.NewBuffer(make([]byte, 0, 2*capacity)))
    14  	assert.True(t, pool.Get().Cap() <= capacity)
    15  }