|
|
|
@ -7,13 +7,14 @@ import ( |
|
|
|
|
|
|
|
|
|
func TestEncode(t *testing.T) { |
|
|
|
|
strRes := "Cdog" |
|
|
|
|
|
|
|
|
|
bytes := Encode("dog") |
|
|
|
|
|
|
|
|
|
str := string(bytes) |
|
|
|
|
if str != strRes { |
|
|
|
|
t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str)) |
|
|
|
|
} |
|
|
|
|
dec,_ := Decode(bytes, 0) |
|
|
|
|
fmt.Printf("raw: %v encoded: %q == %v\n", dec, str, "dog") |
|
|
|
|
//dec,_ := Decode(bytes, 0)
|
|
|
|
|
|
|
|
|
|
sliceRes := "\x83CdogCgodCcat" |
|
|
|
|
strs := []string{"dog", "god", "cat"} |
|
|
|
@ -23,8 +24,7 @@ func TestEncode(t *testing.T) { |
|
|
|
|
t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dec,_ = Decode(bytes, 0) |
|
|
|
|
fmt.Printf("raw: %v encoded: %q == %v\n", dec, slice, strs) |
|
|
|
|
//dec,_ = Decode(bytes, 0)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMultiEncode(t *testing.T) { |
|
|
|
@ -42,10 +42,8 @@ func TestMultiEncode(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bytes := Encode(inter) |
|
|
|
|
fmt.Printf("%q\n", bytes) |
|
|
|
|
|
|
|
|
|
dec, _ := Decode(bytes, 0) |
|
|
|
|
fmt.Println(dec) |
|
|
|
|
Decode(bytes, 0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func BenchmarkEncodeDecode(b *testing.B) { |
|
|
|
|