ceremonyclient/go-libp2p/p2p/metricshelper/pool_test.go
2023-08-20 23:07:43 -05:00

22 lines
351 B
Go

package metricshelper
import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
)
func TestStringSlicePool(t *testing.T) {
for i := 0; i < 1e5; i++ {
s := GetStringSlice()
require.Empty(t, *s)
require.Equal(t, 8, cap(*s))
*s = append(*s, "foo")
*s = append(*s, "bar")
if rand.Int()%3 == 0 {
PutStringSlice(s)
}
}
}