diff options
author | obscuren <obscuren@obscura.com> | 2013-12-28 06:48:44 +0800 |
---|---|---|
committer | obscuren <obscuren@obscura.com> | 2013-12-28 06:48:44 +0800 |
commit | 0f656652e6d76deebcfc7834923adf99eadc050f (patch) | |
tree | 7909794c5b829261452c6156f33876528810e2ea /rlp_test.go | |
parent | 323ba36869126520c294b6c8acacfa9877cde5c7 (diff) | |
download | go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar.gz go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar.bz2 go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar.lz go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar.xz go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.tar.zst go-tangerine-0f656652e6d76deebcfc7834923adf99eadc050f.zip |
Implemented decoding rlp
Diffstat (limited to 'rlp_test.go')
-rw-r--r-- | rlp_test.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rlp_test.go b/rlp_test.go index 922b70978..c2d5ba263 100644 --- a/rlp_test.go +++ b/rlp_test.go @@ -7,14 +7,23 @@ import ( func TestEncode(t *testing.T) { strRes := "Cdog" - str := string(Encode("dog")) + 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") - sliceRes := "\u0083CdogCgodCcat" - slice := string(Encode([]string{"dog", "god", "cat"})) + + sliceRes := "\x83CdogCgodCcat" + strs := []string{"dog", "god", "cat"} + bytes = Encode(strs) + slice := string(bytes) if slice != sliceRes { 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) } |