diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-18 19:48:29 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-18 19:48:29 +0800 |
commit | c4af1340fac12397b6cc5c9f32a1bea4aa6400f5 (patch) | |
tree | 11a7ea038ba4d3015b54a9041214fa4f1e9af786 /ethutil | |
parent | 3bc57fe5b5182cd2e0ae0c6b53b3bbb02ce34304 (diff) | |
download | dexon-c4af1340fac12397b6cc5c9f32a1bea4aa6400f5.tar.gz dexon-c4af1340fac12397b6cc5c9f32a1bea4aa6400f5.tar.zst dexon-c4af1340fac12397b6cc5c9f32a1bea4aa6400f5.zip |
Updated test
Diffstat (limited to 'ethutil')
-rw-r--r-- | ethutil/trie_test.go | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/ethutil/trie_test.go b/ethutil/trie_test.go index 15dbc5567..2937b1525 100644 --- a/ethutil/trie_test.go +++ b/ethutil/trie_test.go @@ -1,12 +1,7 @@ package ethutil import ( - "bytes" - "encoding/json" "fmt" - "io" - "io/ioutil" - "net/http" "reflect" "testing" ) @@ -176,34 +171,23 @@ func TestTriePurge(t *testing.T) { } } -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() - } + _, trie := New() - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Fail() + data := [][]string{ + {"do", "verb"}, + {"ether", "wookiedoo"}, + {"horse", "stallion"}, + {"shaman", "horse"}, + {"doge", "coin"}, + {"ether", ""}, + {"dog", "puppy"}, + {"shaman", ""}, } - 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) + for _, item := range data { + trie.Update(item[0], item[1]) } + + fmt.Printf("root %x", trie.Root) } |