1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-05 13:35:23 +00:00
v2fly/common/io/reader_test.go
2016-11-19 01:50:09 +01:00

23 lines
444 B
Go

package io_test
import (
"bytes"
"testing"
"v2ray.com/core/common/alloc"
. "v2ray.com/core/common/io"
"v2ray.com/core/testing/assert"
)
func TestAdaptiveReader(t *testing.T) {
assert := assert.On(t)
rawContent := make([]byte, 1024*1024)
reader := NewAdaptiveReader(bytes.NewBuffer(rawContent))
b1, err := reader.Read()
assert.Error(err).IsNil()
assert.Bool(b1.IsFull()).IsTrue()
assert.Int(b1.Len()).Equals(alloc.BufferSize)
}