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
393a9281
Commit
393a9281
authored
Oct 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed VM Test code
parent
c5bd32b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
vm_test.go
ethvm/vm_test.go
+16
-10
No files found.
ethvm/vm_test.go
View file @
393a9281
...
...
@@ -25,21 +25,27 @@ func (self TestEnv) Difficulty() *big.Int { return nil }
func
(
self
TestEnv
)
Value
()
*
big
.
Int
{
return
nil
}
func
(
self
TestEnv
)
State
()
*
ethstate
.
State
{
return
nil
}
const
mutcode
=
`
var x = 0;
for i := 0; i < 10; i++ {
x = i
}
return x`
func
setup
(
level
int
,
typ
Type
)
(
*
Closure
,
VirtualMachine
)
{
code
,
err
:=
ethutil
.
Compile
(
mutcode
,
true
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
// Pipe output to /dev/null
ethlog
.
AddLogSystem
(
ethlog
.
NewStdLogSystem
(
ioutil
.
Discard
,
log
.
LstdFlags
,
ethlog
.
LogLevel
(
level
)))
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
stateObject
:=
ethstate
.
NewStateObject
([]
byte
{
'j'
,
'e'
,
'f'
,
'f'
})
callerClosure
:=
NewClosure
(
nil
,
stateObject
,
stateObject
,
[]
byte
{
PUSH1
,
1
,
PUSH1
,
0
,
MSTORE
,
PUSH1
,
32
,
PUSH1
,
0
,
RETURN
,
},
big
.
NewInt
(
1000000
),
big
.
NewInt
(
0
))
callerClosure
:=
NewClosure
(
nil
,
stateObject
,
stateObject
,
code
,
big
.
NewInt
(
1000000
),
big
.
NewInt
(
0
))
return
callerClosure
,
New
(
TestEnv
{},
typ
)
}
...
...
@@ -51,7 +57,7 @@ func TestDebugVm(t *testing.T) {
fmt
.
Println
(
"error"
,
e
)
}
if
ret
[
len
(
ret
)
-
1
]
!=
1
{
if
ret
[
len
(
ret
)
-
1
]
!=
9
{
t
.
Errorf
(
"Expected VM to return 1, got"
,
ret
,
"instead."
)
}
}
...
...
@@ -63,7 +69,7 @@ func TestVm(t *testing.T) {
fmt
.
Println
(
"error"
,
e
)
}
if
ret
[
len
(
ret
)
-
1
]
!=
1
{
if
ret
[
len
(
ret
)
-
1
]
!=
9
{
t
.
Errorf
(
"Expected VM to return 1, got"
,
ret
,
"instead."
)
}
}
...
...
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