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
3c619bae
Commit
3c619bae
authored
Nov 11, 2014
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add verbose comments to TestSnapshot
parent
8f3a03c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
state_test.go
state/state_test.go
+10
-2
No files found.
state/state_test.go
View file @
3c619bae
...
...
@@ -29,20 +29,28 @@ func (s *StateSuite) SetUpTest(c *C) {
}
func
(
s
*
StateSuite
)
TestSnapshot
(
c
*
C
)
{
stateobjaddr
:=
[]
byte
(
"aa"
)
storageaddr
:=
ethutil
.
Big
(
"0"
)
data1
:=
ethutil
.
NewValue
(
42
)
data2
:=
ethutil
.
NewValue
(
43
)
storageaddr
:=
ethutil
.
Big
(
"0"
)
stateobjaddr
:=
[]
byte
(
"aa"
)
// get state object
stateObject
:=
s
.
state
.
GetOrNewStateObject
(
stateobjaddr
)
// set inital state object value
stateObject
.
SetStorage
(
storageaddr
,
data1
)
// get snapshot of current state
snapshot
:=
s
.
state
.
Copy
()
// get state object. is this strictly necessary?
stateObject
=
s
.
state
.
GetStateObject
(
stateobjaddr
)
// set new state object value
stateObject
.
SetStorage
(
storageaddr
,
data2
)
// restore snapshot
s
.
state
.
Set
(
snapshot
)
// get state object
stateObject
=
s
.
state
.
GetStateObject
(
stateobjaddr
)
// get state storage value
res
:=
stateObject
.
GetStorage
(
storageaddr
)
c
.
Assert
(
data1
,
DeepEquals
,
res
,
Commentf
(
expectedasbytes
,
data1
,
res
))
...
...
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