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
bf879ef2
Commit
bf879ef2
authored
Sep 08, 2015
by
Gustav Simonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: test formatting adhering to Go convention
parent
004ed786
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
state_test.go
core/state/state_test.go
+17
-17
No files found.
core/state/state_test.go
View file @
bf879ef2
...
@@ -170,7 +170,7 @@ func TestSnapshot2(t *testing.T) {
...
@@ -170,7 +170,7 @@ func TestSnapshot2(t *testing.T) {
so0Restored
:=
state
.
GetStateObject
(
stateobjaddr0
)
so0Restored
:=
state
.
GetStateObject
(
stateobjaddr0
)
so1Restored
:=
state
.
GetStateObject
(
stateobjaddr1
)
so1Restored
:=
state
.
GetStateObject
(
stateobjaddr1
)
// non-deleted is equal (restored)
// non-deleted is equal (restored)
compareStateObjects
(
so0
,
so0Restored
,
t
)
compareStateObjects
(
so0
Restored
,
so0
,
t
)
// deleted should be nil, both before and after restore of state copy
// deleted should be nil, both before and after restore of state copy
if
so1Restored
!=
nil
{
if
so1Restored
!=
nil
{
t
.
Fatalf
(
"deleted object not nil after restoring snapshot"
)
t
.
Fatalf
(
"deleted object not nil after restoring snapshot"
)
...
@@ -179,45 +179,45 @@ func TestSnapshot2(t *testing.T) {
...
@@ -179,45 +179,45 @@ func TestSnapshot2(t *testing.T) {
func
compareStateObjects
(
so0
,
so1
*
StateObject
,
t
*
testing
.
T
)
{
func
compareStateObjects
(
so0
,
so1
*
StateObject
,
t
*
testing
.
T
)
{
if
so0
.
address
!=
so1
.
address
{
if
so0
.
address
!=
so1
.
address
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
address
,
so1
.
address
)
t
.
Fatalf
(
"
Address mismatch: have %v, wan
t %v"
,
so0
.
address
,
so1
.
address
)
}
}
if
so0
.
balance
.
Cmp
(
so1
.
balance
)
!=
0
{
if
so0
.
balance
.
Cmp
(
so1
.
balance
)
!=
0
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
balance
,
so1
.
balance
)
t
.
Fatalf
(
"
Balance mismatch: have %v, wan
t %v"
,
so0
.
balance
,
so1
.
balance
)
}
}
if
so0
.
nonce
!=
so1
.
nonce
{
if
so0
.
nonce
!=
so1
.
nonce
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
nonce
,
so1
.
nonce
)
t
.
Fatalf
(
"
Nonce mismatch: have %v, wan
t %v"
,
so0
.
nonce
,
so1
.
nonce
)
}
}
if
!
bytes
.
Equal
(
so0
.
codeHash
,
so1
.
codeHash
)
{
if
!
bytes
.
Equal
(
so0
.
codeHash
,
so1
.
codeHash
)
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
codeHash
,
so1
.
codeHash
)
t
.
Fatalf
(
"
CodeHash mismatch: have %v, wan
t %v"
,
so0
.
codeHash
,
so1
.
codeHash
)
}
}
if
!
bytes
.
Equal
(
so0
.
code
,
so1
.
code
)
{
if
!
bytes
.
Equal
(
so0
.
code
,
so1
.
code
)
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
code
,
so1
.
code
)
t
.
Fatalf
(
"
Code mismatch: have %v, wan
t %v"
,
so0
.
code
,
so1
.
code
)
}
}
if
!
bytes
.
Equal
(
so0
.
initCode
,
so1
.
initCode
)
{
if
!
bytes
.
Equal
(
so0
.
initCode
,
so1
.
initCode
)
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
initCode
,
so1
.
initCode
)
t
.
Fatalf
(
"
InitCode mismatch: have %v, wan
t %v"
,
so0
.
initCode
,
so1
.
initCode
)
}
}
for
k
,
v
:=
range
so0
.
storage
{
if
so1
.
storage
[
k
]
!=
v
{
t
.
Fatalf
(
"
\n
storage key %s:
\n
expected %v
\n
got %v"
,
k
,
v
,
so1
.
storage
[
k
])
}
}
for
k
,
v
:=
range
so1
.
storage
{
for
k
,
v
:=
range
so1
.
storage
{
if
so0
.
storage
[
k
]
!=
v
{
if
so0
.
storage
[
k
]
!=
v
{
t
.
Fatalf
(
"
\n
unexpected k,v : %v, %v"
,
k
,
v
)
t
.
Fatalf
(
"Storage key %s mismatch: have %v, want %v"
,
k
,
so0
.
storage
[
k
],
v
)
}
}
for
k
,
v
:=
range
so0
.
storage
{
if
so1
.
storage
[
k
]
!=
v
{
t
.
Fatalf
(
"Storage key %s mismatch: have %v, want none."
,
k
,
v
)
}
}
}
}
if
so0
.
gasPool
.
Cmp
(
so1
.
gasPool
)
!=
0
{
if
so0
.
gasPool
.
Cmp
(
so1
.
gasPool
)
!=
0
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
gasPool
,
so1
.
gasPool
)
t
.
Fatalf
(
"
GasPool mismatch: have %v, wan
t %v"
,
so0
.
gasPool
,
so1
.
gasPool
)
}
}
if
so0
.
remove
!=
so1
.
remove
{
if
so0
.
remove
!=
so1
.
remove
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
remove
,
so1
.
remove
)
t
.
Fatalf
(
"
Remove mismatch: have %v, wan
t %v"
,
so0
.
remove
,
so1
.
remove
)
}
}
if
so0
.
deleted
!=
so1
.
deleted
{
if
so0
.
deleted
!=
so1
.
deleted
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
deleted
,
so1
.
deleted
)
t
.
Fatalf
(
"
Deleted mismatch: have %v, wan
t %v"
,
so0
.
deleted
,
so1
.
deleted
)
}
}
if
so0
.
dirty
!=
so1
.
dirty
{
if
so0
.
dirty
!=
so1
.
dirty
{
t
.
Fatalf
(
"
\n
expected %v
\n
go
t %v"
,
so0
.
dirty
,
so1
.
dirty
)
t
.
Fatalf
(
"
Dirty mismatch: have %v, wan
t %v"
,
so0
.
dirty
,
so1
.
dirty
)
}
}
}
}
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