aboutsummaryrefslogtreecommitdiffstats
path: root/serialization_test.go
diff options
context:
space:
mode:
authorobscuren <obscuren@obscura.com>2013-12-26 19:45:52 +0800
committerobscuren <obscuren@obscura.com>2013-12-26 19:45:52 +0800
commit5db3335dce766bd679c54ea44f6df08a7ff74762 (patch)
tree75614c847fdc07150351e9aa02353d8f1d23196c /serialization_test.go
downloaddexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar.gz
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar.bz2
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar.lz
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar.xz
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.tar.zst
dexon-5db3335dce766bd679c54ea44f6df08a7ff74762.zip
Initial commit
Diffstat (limited to 'serialization_test.go')
-rw-r--r--serialization_test.go20
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))
+ }
+}