diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-11-29 08:21:41 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-11-29 08:25:32 +0800 |
commit | b33a5294eaf06a3e952efe1ce4ef810af37d1062 (patch) | |
tree | efb7b8e936fe001180067703fcb226c90779023a /common/bytes_test.go | |
parent | be12392fbad9f4a861130a347e6bcf07a5c34974 (diff) | |
download | dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar.gz dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar.bz2 dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar.lz dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar.xz dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.tar.zst dexon-b33a5294eaf06a3e952efe1ce4ef810af37d1062.zip |
common: fix hex utils to handle 1 byte address conversions
Diffstat (limited to 'common/bytes_test.go')
-rw-r--r-- | common/bytes_test.go | 13 |
1 files changed, 11 insertions, 2 deletions
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) } } |