first commit
This commit is contained in:
27
buffer_test.go
Normal file
27
buffer_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package bin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuffer(t *testing.T) {
|
||||
arr := make([]byte, 0)
|
||||
|
||||
buf := NewBuffer(arr)
|
||||
buf.WriteByte(100)
|
||||
|
||||
fmt.Println(buf.ByteAt(0))
|
||||
|
||||
buf.Write([]byte{1, 2, 3})
|
||||
buf.WriteByteAt(200, 0)
|
||||
|
||||
fmt.Println(buf.ByteAt(0))
|
||||
|
||||
fmt.Println(buf.Bytes())
|
||||
|
||||
buf.Reset()
|
||||
|
||||
fmt.Println(buf.Bytes())
|
||||
fmt.Println(buf.Len())
|
||||
}
|
||||
Reference in New Issue
Block a user