MCPcopy
hub / github.com/grafana/tempo / TestReadAllWithEstimate

Function TestReadAllWithEstimate

pkg/io/read_test.go:13–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11var testBufLength = 10
12
13func TestReadAllWithEstimate(t *testing.T) {
14 buf := make([]byte, testBufLength)
15 _, err := rand.Read(buf)
16 assert.NoError(t, err)
17 assert.Equal(t, testBufLength, len(buf))
18 assert.Equal(t, testBufLength, cap(buf))
19
20 actualBuf, err := ReadAllWithEstimate(bytes.NewReader(buf), int64(testBufLength))
21 assert.NoError(t, err)
22 assert.Equal(t, buf, actualBuf)
23 assert.Equal(t, testBufLength, len(actualBuf))
24 assert.Equal(t, testBufLength+1, cap(actualBuf)) // one extra byte used in ReadAllWithEstimate
25}

Callers

nothing calls this directly

Calls 3

ReadAllWithEstimateFunction · 0.85
ReadMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected