diff options
Diffstat (limited to 'serialization_test.go')
-rw-r--r-- | serialization_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/serialization_test.go b/serialization_test.go new file mode 100644 index 000000000..adb1b6e2d --- /dev/null +++ b/serialization_test.go @@ -0,0 +1,20 @@ +package main + +import ( + "testing" + "fmt" +) + +func TestRlpEncode(t *testing.T) { + strRes := "\x00\x03dog" + str := RlpEncode("dog") + if str != strRes { + t.Error(fmt.Sprintf("Expected %q, got %q", strRes, str)) + } + + sliceRes := "\x01\x00\x03dog\x00\x03god\x00\x03cat" + slice := RlpEncode([]string{"dog", "god", "cat"}) + if slice != sliceRes { + t.Error(fmt.Sprintf("Expected %q, got %q", sliceRes, slice)) + } +} |