diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-06 00:44:28 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-06 00:44:28 +0800 |
commit | ada684e05458cce26a97b245cd96a8fd72523daa (patch) | |
tree | 6e425ce2cdfb6ac33f15e4a1a1979e3731c4ee4a | |
parent | 92b30cc452d71a84927529b50ac9aa40eb0d550e (diff) | |
download | dexon-ada684e05458cce26a97b245cd96a8fd72523daa.tar.gz dexon-ada684e05458cce26a97b245cd96a8fd72523daa.tar.zst dexon-ada684e05458cce26a97b245cd96a8fd72523daa.zip |
added test for BinaryLength
-rw-r--r-- | ethutil/bytes_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ethutil/bytes_test.go b/ethutil/bytes_test.go index 051f924d4..2a106d585 100644 --- a/ethutil/bytes_test.go +++ b/ethutil/bytes_test.go @@ -115,3 +115,22 @@ func TestReadVarInt(t *testing.T) { t.Errorf("Expected %d | Got %d", exp1, res1) } } + +func TestBinaryLength(t *testing.T) { + data1 := 0 + data2 := 920987656789 + + exp1 := 0 + exp2 := 5 + + res1 := BinaryLength(data1) + res2 := BinaryLength(data2) + + if res1 != exp1 { + t.Errorf("Expected %d got %d", exp1, res1) + } + + if res2 != exp2 { + t.Errorf("Expected %d got %d", exp2, res2) + } +} |