Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
c4af1340
Commit
c4af1340
authored
Jun 18, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated test
parent
3bc57fe5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
30 deletions
+14
-30
trie_test.go
ethutil/trie_test.go
+14
-30
No files found.
ethutil/trie_test.go
View file @
c4af1340
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
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment