aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2014-11-06 05:00:01 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2014-11-06 05:00:01 +0800
commitab6b9c44aa97a18e37dcd9214eadbdfaa38a4b22 (patch)
tree19eb52ee6ecf9ad1bdb1d0fba66acf2a7235cb0d
parent4e15adac6d46acb5b8173050618a1ffac525e528 (diff)
downloadgo-tangerine-ab6b9c44aa97a18e37dcd9214eadbdfaa38a4b22.tar.gz
go-tangerine-ab6b9c44aa97a18e37dcd9214eadbdfaa38a4b22.tar.zst
go-tangerine-ab6b9c44aa97a18e37dcd9214eadbdfaa38a4b22.zip
Added test for IsHex
-rw-r--r--ethutil/bytes_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/ethutil/bytes_test.go b/ethutil/bytes_test.go
index 82167f054..ee69b38b5 100644
--- a/ethutil/bytes_test.go
+++ b/ethutil/bytes_test.go
@@ -16,6 +16,23 @@ func TestByteString(t *testing.T) {
}
}
+
+func TestIsHex(t *testing.T) {
+ data1 := "a9e67e"
+ exp1 := false
+ res1 := IsHex(data1)
+ if exp1 != res1 {
+ t.Errorf("Expected % x Got % x", exp1, res1)
+ }
+
+ data2 := "0xa9e67e00"
+ exp2 := true
+ res2 := IsHex(data2)
+ if exp2 != res2 {
+ t.Errorf("Expected % x Got % x", exp2, res2)
+ }
+}
+
func TestParseDataString(t *testing.T) {
data := ParseData("hello", "world", "0x0106")
exp := "68656c6c6f000000000000000000000000000000000000000000000000000000776f726c640000000000000000000000000000000000000000000000000000000106000000000000000000000000000000000000000000000000000000000000"