Reorg state tests
This commit is contained in:
parent
6eacc8eab9
commit
bd9bd4abed
|
@ -0,0 +1,8 @@
|
||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
checker "gopkg.in/check.v1"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test(t *testing.T) { checker.TestingT(t) }
|
|
@ -1,34 +1,29 @@
|
||||||
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) {
|
||||||
// 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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue