package utils import ( "bytes" "testing" checker "gopkg.in/check.v1" ) type BytesSuite struct{} var _ = checker.Suite(&BytesSuite{}) func TestFromHex(t *testing.T) { input := "0x01" expected := []byte{1} result := FromHex(input) if !bytes.Equal(expected, result) { t.Errorf("Expected %x got %x", expected, result) } } func TestFromHexOddLength(t *testing.T) { input := "0x1" expected := []byte{1} result := FromHex(input) if !bytes.Equal(expected, result) { t.Errorf("Expected %x got %x", expected, result) } } func TestNoPrefixShortHexOddLength(t *testing.T) { input := "1" expected := []byte{1} result := FromHex(input) if !bytes.Equal(expected, result) { t.Errorf("Expected %x got %x", expected, result) } }