(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestPoolSlicesAreAlwaysLargeEnough(t *testing.T) { |
| 59 | testPool := NewPool("foo", 100, 200, 5) |
| 60 | |
| 61 | for i := 0; i < 10000; i++ { |
| 62 | size := rand.Intn(1000) |
| 63 | externalSlice := make([]byte, 0, size) |
| 64 | testPool.Put(externalSlice) |
| 65 | |
| 66 | size = rand.Intn(1000) |
| 67 | ret := testPool.Get(size) |
| 68 | |
| 69 | require.True(t, cap(ret) >= size, "cap: %d, size: %d", cap(ret), size) |
| 70 | |
| 71 | testPool.Put(ret) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func TestBucketFor(t *testing.T) { |
| 76 | testPool := NewPool("foo", 5, 10, 5) |