(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func (s) TestBufferPool(t *testing.T) { |
| 31 | var poolSizes = []int{4, 8, 16, 32} |
| 32 | pools := []mem.BufferPool{ |
| 33 | mem.NopBufferPool{}, |
| 34 | mem.NewTieredBufferPool(poolSizes...), |
| 35 | } |
| 36 | |
| 37 | testSizes := append([]int{1}, poolSizes...) |
| 38 | testSizes = append(testSizes, 64) |
| 39 | |
| 40 | for _, p := range pools { |
| 41 | for _, l := range testSizes { |
| 42 | bs := p.Get(l) |
| 43 | if len(*bs) != l { |
| 44 | t.Fatalf("Get(%d) returned buffer of length %d, want %d", l, len(*bs), l) |
| 45 | } |
| 46 | |
| 47 | p.Put(bs) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func (s) TestBufferPoolClears(t *testing.T) { |
| 53 | const poolSize = 4 |
nothing calls this directly
no test coverage detected