Contact card decompress, split, merge
This commit is contained in:
24
buffer_test.go
Normal file
24
buffer_test.go
Normal file
@ -0,0 +1,24 @@
|
||||
package meowlib
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBufferSplit(t *testing.T) {
|
||||
|
||||
source := []byte("Hello World, I need to slice you, but in equal parts, not the capitalist way")
|
||||
packets, err := BufferSplit(source, 3)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to encode address book:", err)
|
||||
}
|
||||
println(len(packets))
|
||||
destination, err := BufferMerge(packets)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to encode address book:", err)
|
||||
}
|
||||
println(string(destination))
|
||||
assert.Equal(t, source, destination, "The two buffers should be the same.")
|
||||
}
|
Reference in New Issue
Block a user