aboutsummaryrefslogtreecommitdiffstats
path: root/serialization_test.go
blob: adb1b6e2d5ad8f48cddf4530008f747f9dfabafb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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))
  }
}