diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-13 05:02:39 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-13 05:02:39 +0800 |
commit | bd9bd4abed09a1ac7a686e9a61d925d1a69445a6 (patch) | |
tree | 1ad699eb971c899df1608df7a38ecc6ef4582fad | |
parent | 6eacc8eab9ad605c76a936361c0015d1ba905da1 (diff) | |
download | dexon-bd9bd4abed09a1ac7a686e9a61d925d1a69445a6.tar.gz dexon-bd9bd4abed09a1ac7a686e9a61d925d1a69445a6.tar.zst dexon-bd9bd4abed09a1ac7a686e9a61d925d1a69445a6.zip |
Reorg state tests
-rw-r--r-- | state/main_test.go | 8 | ||||
-rw-r--r-- | state/state_test.go | 15 |
2 files changed, 13 insertions, 10 deletions
diff --git a/state/main_test.go b/state/main_test.go new file mode 100644 index 000000000..973a7c373 --- /dev/null +++ b/state/main_test.go @@ -0,0 +1,8 @@ +package state + +import ( + checker "gopkg.in/check.v1" + "testing" +) + +func Test(t *testing.T) { checker.TestingT(t) } diff --git a/state/state_test.go b/state/state_test.go index 9dd965e95..8942f51ec 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -1,34 +1,29 @@ package state import ( - . "gopkg.in/check.v1" - "testing" + checker "gopkg.in/check.v1" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/trie" ) -func Test(t *testing.T) { TestingT(t) } - type StateSuite struct { state *State } -var _ = Suite(&StateSuite{}) - -const expectedasbytes = "Expected % x Got % x" +var _ = checker.Suite(&StateSuite{}) // var ZeroHash256 = make([]byte, 32) -func (s *StateSuite) SetUpTest(c *C) { +func (s *StateSuite) SetUpTest(c *checker.C) { db, _ := ethdb.NewMemDatabase() ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") ethutil.Config.Db = db s.state = New(trie.New(db, "")) } -func (s *StateSuite) TestSnapshot(c *C) { +func (s *StateSuite) TestSnapshot(c *checker.C) { stateobjaddr := []byte("aa") storageaddr := ethutil.Big("0") data1 := ethutil.NewValue(42) @@ -53,5 +48,5 @@ func (s *StateSuite) TestSnapshot(c *C) { // get state storage value res := stateObject.GetStorage(storageaddr) - c.Assert(data1, DeepEquals, res, Commentf(expectedasbytes, data1, res)) + c.Assert(data1, checker.DeepEquals, res) } |