Fixed issue where JUMPI would do an equally check with 1 instead of GT

This commit is contained in:
obscuren
2014-06-17 18:05:46 +02:00
parent a90ffe1af1
commit 34c8045d5b
5 changed files with 49 additions and 36 deletions

View File

@ -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)
}
}