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
bd9bd4ab
Commit
bd9bd4ab
authored
Nov 12, 2014
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorg state tests
parent
6eacc8ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
main_test.go
state/main_test.go
+8
-0
state_test.go
state/state_test.go
+5
-10
No files found.
state/main_test.go
0 → 100644
View file @
bd9bd4ab
package
state
import
(
checker
"gopkg.in/check.v1"
"testing"
)
func
Test
(
t
*
testing
.
T
)
{
checker
.
TestingT
(
t
)
}
state/state_test.go
View file @
bd9bd4ab
package
state
package
state
import
(
import
(
.
"gopkg.in/check.v1"
checker
"gopkg.in/check.v1"
"testing"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie"
)
)
func
Test
(
t
*
testing
.
T
)
{
TestingT
(
t
)
}
type
StateSuite
struct
{
type
StateSuite
struct
{
state
*
State
state
*
State
}
}
var
_
=
Suite
(
&
StateSuite
{})
var
_
=
checker
.
Suite
(
&
StateSuite
{})
const
expectedasbytes
=
"Expected % x Got % x"
// var ZeroHash256 = make([]byte, 32)
// var ZeroHash256 = make([]byte, 32)
func
(
s
*
StateSuite
)
SetUpTest
(
c
*
C
)
{
func
(
s
*
StateSuite
)
SetUpTest
(
c
*
checker
.
C
)
{
db
,
_
:=
ethdb
.
NewMemDatabase
()
db
,
_
:=
ethdb
.
NewMemDatabase
()
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
ethutil
.
ReadConfig
(
".ethtest"
,
"/tmp/ethtest"
,
""
)
ethutil
.
Config
.
Db
=
db
ethutil
.
Config
.
Db
=
db
s
.
state
=
New
(
trie
.
New
(
db
,
""
))
s
.
state
=
New
(
trie
.
New
(
db
,
""
))
}
}
func
(
s
*
StateSuite
)
TestSnapshot
(
c
*
C
)
{
func
(
s
*
StateSuite
)
TestSnapshot
(
c
*
checker
.
C
)
{
stateobjaddr
:=
[]
byte
(
"aa"
)
stateobjaddr
:=
[]
byte
(
"aa"
)
storageaddr
:=
ethutil
.
Big
(
"0"
)
storageaddr
:=
ethutil
.
Big
(
"0"
)
data1
:=
ethutil
.
NewValue
(
42
)
data1
:=
ethutil
.
NewValue
(
42
)
...
@@ -53,5 +48,5 @@ func (s *StateSuite) TestSnapshot(c *C) {
...
@@ -53,5 +48,5 @@ func (s *StateSuite) TestSnapshot(c *C) {
// get state storage value
// get state storage value
res
:=
stateObject
.
GetStorage
(
storageaddr
)
res
:=
stateObject
.
GetStorage
(
storageaddr
)
c
.
Assert
(
data1
,
DeepEquals
,
res
,
Commentf
(
expectedasbytes
,
data1
,
res
)
)
c
.
Assert
(
data1
,
checker
.
DeepEquals
,
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