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
3bc64b6b
Commit
3bc64b6b
authored
Oct 18, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Readers
parent
73c1c2c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
readers.go
tests/helper/readers.go
+42
-0
gh_test.go
tests/vm/gh_test.go
+2
-2
No files found.
tests/helper/
http
.go
→
tests/helper/
readers
.go
View file @
3bc64b6b
...
...
@@ -2,12 +2,22 @@ package helper
import
(
"encoding/json"
"io"
"io/ioutil"
"net/http"
"os"
"testing"
)
func
CreateTests
(
t
*
testing
.
T
,
uri
string
,
value
interface
{})
{
func
readJSON
(
t
*
testing
.
T
,
reader
io
.
Reader
,
value
interface
{})
{
data
,
err
:=
ioutil
.
ReadAll
(
reader
)
err
=
json
.
Unmarshal
(
data
,
&
value
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
}
func
CreateHttpTests
(
t
*
testing
.
T
,
uri
string
,
value
interface
{})
{
resp
,
err
:=
http
.
Get
(
uri
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -16,10 +26,17 @@ func CreateTests(t *testing.T, uri string, value interface{}) {
}
defer
resp
.
Body
.
Close
()
data
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
readJSON
(
t
,
resp
.
Body
,
value
)
}
err
=
json
.
Unmarshal
(
data
,
&
value
)
func
CreateFileTests
(
t
*
testing
.
T
,
fn
string
,
value
interface
{})
{
file
,
err
:=
os
.
Open
(
fn
)
if
err
!=
nil
{
t
.
Error
(
err
)
return
}
defer
file
.
Close
()
readJSON
(
t
,
file
,
value
)
}
tests/vm/gh_test.go
View file @
3bc64b6b
...
...
@@ -41,7 +41,7 @@ type VmTest struct {
func
RunVmTest
(
url
string
,
t
*
testing
.
T
)
{
tests
:=
make
(
map
[
string
]
VmTest
)
helper
.
CreateTests
(
t
,
url
,
&
tests
)
helper
.
Create
Http
Tests
(
t
,
url
,
&
tests
)
for
name
,
test
:=
range
tests
{
state
:=
ethstate
.
New
(
helper
.
NewTrie
())
...
...
@@ -88,12 +88,12 @@ func RunVmTest(url string, t *testing.T) {
// I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail.
func
TestVMArithmetic
(
t
*
testing
.
T
)
{
//helper.Logger.SetLogLevel(5)
const
url
=
"https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmArithmeticTest.json"
RunVmTest
(
url
,
t
)
}
func
TestVMSystemOperation
(
t
*
testing
.
T
)
{
//helper.Logger.SetLogLevel(5)
const
url
=
"https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmSystemOperationsTest.json"
RunVmTest
(
url
,
t
)
}
...
...
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