aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/trie_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-18 00:05:46 +0800
committerobscuren <geffobscura@gmail.com>2014-06-18 00:05:46 +0800
commit34c8045d5be6488e9800c24e1e696e1b912f344c (patch)
tree322b1500e7e02b5fa5b2fab094605e433fdb6796 /ethutil/trie_test.go
parenta90ffe1af1b28935fc77a2c5cf37972bac03f062 (diff)
downloadgo-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar.gz
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar.bz2
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar.lz
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar.xz
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.tar.zst
go-tangerine-34c8045d5be6488e9800c24e1e696e1b912f344c.zip
Fixed issue where JUMPI would do an equally check with 1 instead of GT
Diffstat (limited to 'ethutil/trie_test.go')
-rw-r--r--ethutil/trie_test.go41
1 files changed, 33 insertions, 8 deletions
diff --git a/ethutil/trie_test.go b/ethutil/trie_test.go
index c89f2fbb7..15dbc5567 100644
--- a/ethutil/trie_test.go
+++ b/ethutil/trie_test.go
@@ -1,7 +1,12 @@
package ethutil
import (
+ "bytes"
+ "encoding/json"
"fmt"
+ "io"
+ "io/ioutil"
+ "net/http"
"reflect"
"testing"
)
@@ -171,14 +176,34 @@ func TestTriePurge(t *testing.T) {
}
}
+type TestItem struct {
+ Name string
+ Inputs [][]string
+ Expectations string
+}
+
func TestTrieIt(t *testing.T) {
- _, trie := New()
- trie.Update("c", LONG_WORD)
- trie.Update("ca", LONG_WORD)
- trie.Update("cat", LONG_WORD)
+ //_, trie := New()
+ resp, err := http.Get("https://raw.githubusercontent.com/ethereum/tests/master/trietest.json")
+ if err != nil {
+ t.Fail()
+ }
- it := trie.NewIterator()
- it.Each(func(key string, node *Value) {
- fmt.Println(key, ":", node.Str())
- })
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ t.Fail()
+ }
+
+ dec := json.NewDecoder(bytes.NewReader(body))
+ for {
+ var test TestItem
+ if err := dec.Decode(&test); err == io.EOF {
+ break
+ } else if err != nil {
+ t.Error("Fail something", err)
+ break
+ }
+ fmt.Println(test)
+ }
}