Fixed issue where JUMPI would do an equally check with 1 instead of GT
This commit is contained in:
@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrieIt(t *testing.T) {
|
||||
_, trie := New()
|
||||
trie.Update("c", LONG_WORD)
|
||||
trie.Update("ca", LONG_WORD)
|
||||
trie.Update("cat", LONG_WORD)
|
||||
|
||||
it := trie.NewIterator()
|
||||
it.Each(func(key string, node *Value) {
|
||||
fmt.Println(key, ":", node.Str())
|
||||
})
|
||||
type TestItem struct {
|
||||
Name string
|
||||
Inputs [][]string
|
||||
Expectations string
|
||||
}
|
||||
|
||||
func TestTrieIt(t *testing.T) {
|
||||
//_, trie := New()
|
||||
resp, err := http.Get("https://raw.githubusercontent.com/ethereum/tests/master/trietest.json")
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user