github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/gtl/tests/freepool_test.go (about) 1 package tests 2 3 //go:generate ../generate.py --prefix=byte --PREFIX=byte -DMAXSIZE=128 -DELEM=[]byte --package=tests --output=freepool.go ../freepool.go.tpl 4 5 import ( 6 "testing" 7 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestFreepool(t *testing.T) { 12 pool := bytePool{New: func() []byte { return []byte{10, 11} }} 13 14 assert.Equal(t, []byte{10, 11}, pool.Get()) 15 pool.Put([]byte{20, 21}) 16 assert.Equal(t, []byte{20, 21}, pool.Get()) 17 }