diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-15 20:21:11 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-15 20:21:11 +0800 |
commit | 07c12f0b921a05aec668ae8ce63b6dfac51d76a6 (patch) | |
tree | 48f9b9b9eee50353e79a847bf94d31c1e4e0d2c3 /ethutil/value_test.go | |
parent | 5883446b219a2980d67ff604c7f227089e5c8619 (diff) | |
download | dexon-07c12f0b921a05aec668ae8ce63b6dfac51d76a6.tar.gz dexon-07c12f0b921a05aec668ae8ce63b6dfac51d76a6.tar.zst dexon-07c12f0b921a05aec668ae8ce63b6dfac51d76a6.zip |
Added trie tests, value tests
Diffstat (limited to 'ethutil/value_test.go')
-rw-r--r-- | ethutil/value_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ethutil/value_test.go b/ethutil/value_test.go new file mode 100644 index 000000000..7d41eb1c9 --- /dev/null +++ b/ethutil/value_test.go @@ -0,0 +1,38 @@ +package ethutil + +import ( + "testing" +) + +func TestValueCmp(t *testing.T) { + val1 := NewValue("hello") + val2 := NewValue("world") + if val1.Cmp(val2) { + t.Error("Expected values not to be equal") + } + + val3 := NewValue("hello") + val4 := NewValue("hello") + if !val3.Cmp(val4) { + t.Error("Expected values to be equal") + } +} + +func TestValueTypes(t *testing.T) { + str := NewValue("str") + num := NewValue(1) + inter := NewValue([]interface{}{1}) + + if str.Str() != "str" { + t.Errorf("expected Str to return 'str', got %s", str.Str()) + } + + if num.Uint() != 1 { + t.Errorf("expected Uint to return '1', got %d", num.Uint()) + } + + exp := []interface{}{1} + if !NewValue(inter.Interface()).Cmp(NewValue(exp)) { + t.Errorf("expected Interface to return '%v', got %v", exp, num.Interface()) + } +} |