(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestPreallocTimeseriesSliceFromPool(t *testing.T) { |
| 33 | t.Run("new instance is provided when not available to reuse", func(t *testing.T) { |
| 34 | first := PreallocTimeseriesSliceFromPool() |
| 35 | second := PreallocTimeseriesSliceFromPool() |
| 36 | |
| 37 | assert.NotSame(t, &first, &second) |
| 38 | }) |
| 39 | |
| 40 | t.Run("instance is cleaned before reusing", func(t *testing.T) { |
| 41 | slice := PreallocTimeseriesSliceFromPool() |
| 42 | slice = append(slice, PreallocTimeseries{TimeSeries: &TimeSeries{}}) |
| 43 | ReuseSlice(slice) |
| 44 | |
| 45 | reused := PreallocTimeseriesSliceFromPool() |
| 46 | assert.Len(t, reused, 0) |
| 47 | }) |
| 48 | } |
| 49 | |
| 50 | func TestTimeseriesFromPool(t *testing.T) { |
| 51 | t.Run("new instance is provided when not available to reuse", func(t *testing.T) { |
nothing calls this directly
no test coverage detected