aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/util_test.go
blob: b0a4979b5abcfa1468c889fad047b9977122279a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package rpc

import (
    "bytes"
    "testing"
)

//fromHex
func TestFromHex(t *testing.T) {
    input := "0x01"
    expected := []byte{1}
    result := fromHex(input)
    if bytes.Compare(expected, result) != 0 {
        t.Errorf("Expected % x got % x", expected, result)
    }
}

func TestFromHexOddLength(t *testing.T) {
    input := "0x1"
    expected := []byte{1}
    result := fromHex(input)
    if bytes.Compare(expected, result) != 0 {
        t.Errorf("Expected % x got % x", expected, result)
    }
}