Commit 9d0e6bcf authored by Steven Allen's avatar Steven Allen

add test for overallocation in chunker

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent 03fd98e7
......@@ -22,6 +22,20 @@ func copyBuf(buf []byte) []byte {
return cpy
}
func TestSizeSplitterOverAllocate(t *testing.T) {
max := 1000
r := bytes.NewReader(randBuf(t, max))
chunksize := int64(1024 * 256)
splitter := NewSizeSplitter(r, chunksize)
chunk, err := splitter.NextBytes()
if err != nil {
t.Fatal(err)
}
if cap(chunk) > len(chunk) {
t.Fatal("chunk capacity too large")
}
}
func TestSizeSplitterIsDeterministic(t *testing.T) {
if testing.Short() {
t.SkipNow()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment