mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-18 02:16:10 -05:00
22 lines
381 B
Go
22 lines
381 B
Go
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)
|
|
}
|