You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/common/buf/reader_test.go

22 lines
381 B

package buf_test
import (
"bytes"
"testing"
. "v2ray.com/core/common/buf"
"v2ray.com/core/testing/assert"
)
func TestAdaptiveReader(t *testing.T) {
assert := assert.On(t)
rawContent := make([]byte, 1024*1024)
buffer := bytes.NewBuffer(rawContent)
reader := NewReader(buffer)
b, err := reader.Read()
assert.Error(err).IsNil()
assert.Int(b.Len()).Equals(32 * 1024)
}