Contact card decompress, split, merge

This commit is contained in:
ycc
2022-11-29 22:19:54 +01:00
parent b464a855ae
commit d5760e8439
3 changed files with 129 additions and 3 deletions

24
buffer_test.go Normal file
View 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.")
}