mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 23:44:59 +02:00
Import base85.go into tree
Upstream is not maintained last commit was six years ago and there are various improvements to be had in the code
This commit is contained in:
60
tools/utils/base85/base85_test.go
Normal file
60
tools/utils/base85/base85_test.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package base85
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func TestChunked (t *testing.T) {
|
||||
a := []byte("M")
|
||||
fmt.Printf("a %#v\n", a)
|
||||
b := make([]byte, EncodedLen(len(a)))
|
||||
encodeChunk(b, a)
|
||||
fmt.Printf("b %#v\n", b)
|
||||
c := make([]byte, DecodedLen(len(b)))
|
||||
decodeChunk(c, b)
|
||||
fmt.Printf("c %#v\n", c)
|
||||
|
||||
a = []byte("Ma")
|
||||
fmt.Printf("a %#v\n", a)
|
||||
b = make([]byte, EncodedLen(len(a)))
|
||||
encodeChunk(b, a)
|
||||
fmt.Printf("b %#v\n", b)
|
||||
c = make([]byte, DecodedLen(len(b)))
|
||||
decodeChunk(c, b)
|
||||
fmt.Printf("c %#v\n", c)
|
||||
|
||||
a = []byte("Man")
|
||||
fmt.Printf("a %#v\n", a)
|
||||
b = make([]byte, EncodedLen(len(a)))
|
||||
encodeChunk(b, a)
|
||||
fmt.Printf("b %#v\n", b)
|
||||
c = make([]byte, DecodedLen(len(b)))
|
||||
decodeChunk(c, b)
|
||||
fmt.Printf("c %#v\n", c)
|
||||
|
||||
a = []byte("Man ")
|
||||
fmt.Printf("a %#v\n", a)
|
||||
b = make([]byte, EncodedLen(len(a)))
|
||||
encodeChunk(b, a)
|
||||
fmt.Printf("b %#v\n", b)
|
||||
c = make([]byte, DecodedLen(len(b)))
|
||||
decodeChunk(c, b)
|
||||
fmt.Printf("c %#v\n", c)
|
||||
|
||||
a = []byte("Manual")
|
||||
fmt.Printf("a %#v\n", a)
|
||||
b = make([]byte, EncodedLen(len(a)))
|
||||
n := Encode(b, a)
|
||||
fmt.Printf("b %#v %d\n", b, n)
|
||||
c = make([]byte, DecodedLen(len(b)))
|
||||
n, _ = Decode(c, b)
|
||||
fmt.Printf("c %#v %d\n", c, n)
|
||||
|
||||
a = []byte("Manual")
|
||||
fmt.Printf("a %s\n", a)
|
||||
sb := EncodeToString(a) + "\""
|
||||
fmt.Printf("b %#v\n", sb)
|
||||
sc, err := DecodeString(sb)
|
||||
fmt.Printf("c %s %s\n", sc, err)
|
||||
}
|
||||
Reference in New Issue
Block a user