Updated rlp encoding. (requires verification!)

This commit is contained in:
obscuren
2013-12-27 22:32:55 +01:00
parent df0fe67fce
commit 323ba36869
2 changed files with 95 additions and 16 deletions

20
rlp_test.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"testing"
"fmt"
)
func TestEncode(t *testing.T) {
strRes := "Cdog"
str := string(Encode("dog"))
if str != strRes {
t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str))
}
sliceRes := "\u0083CdogCgodCcat"
slice := string(Encode([]string{"dog", "god", "cat"}))
if slice != sliceRes {
t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice))
}
}