From b33a5294eaf06a3e952efe1ce4ef810af37d1062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 29 Nov 2017 02:21:41 +0200 Subject: common: fix hex utils to handle 1 byte address conversions --- common/bytes_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'common/bytes_test.go') diff --git a/common/bytes_test.go b/common/bytes_test.go index fc164b13d..71631e6dd 100644 --- a/common/bytes_test.go +++ b/common/bytes_test.go @@ -74,7 +74,7 @@ func TestFromHex(t *testing.T) { expected := []byte{1} result := FromHex(input) if !bytes.Equal(expected, result) { - t.Errorf("Expected % x got % x", expected, result) + t.Errorf("Expected %x got %x", expected, result) } } @@ -83,6 +83,15 @@ func TestFromHexOddLength(t *testing.T) { expected := []byte{1} result := FromHex(input) if !bytes.Equal(expected, result) { - t.Errorf("Expected % x got % x", 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) } } -- cgit v1.2.3