Commit c4af1340 authored by obscuren's avatar obscuren

Updated test

parent 3bc57fe5
package ethutil package ethutil
import ( import (
"bytes"
"encoding/json"
"fmt" "fmt"
"io"
"io/ioutil"
"net/http"
"reflect" "reflect"
"testing" "testing"
) )
...@@ -176,34 +171,23 @@ func TestTriePurge(t *testing.T) { ...@@ -176,34 +171,23 @@ func TestTriePurge(t *testing.T) {
} }
} }
type TestItem struct {
Name string
Inputs [][]string
Expectations string
}
func TestTrieIt(t *testing.T) { func TestTrieIt(t *testing.T) {
//_, trie := New() _, trie := New()
resp, err := http.Get("https://raw.githubusercontent.com/ethereum/tests/master/trietest.json")
if err != nil {
t.Fail()
}
defer resp.Body.Close() data := [][]string{
body, err := ioutil.ReadAll(resp.Body) {"do", "verb"},
if err != nil { {"ether", "wookiedoo"},
t.Fail() {"horse", "stallion"},
{"shaman", "horse"},
{"doge", "coin"},
{"ether", ""},
{"dog", "puppy"},
{"shaman", ""},
} }
dec := json.NewDecoder(bytes.NewReader(body)) for _, item := range data {
for { trie.Update(item[0], item[1])
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)
} }
fmt.Printf("root %x", trie.Root)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment