diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-11 20:07:24 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-11 20:07:24 +0800 |
commit | 3c619baec58947aa8b02e4a807a3e837d8fa73fd (patch) | |
tree | 7abf5f28f7ffaa679dee3bd183876895457bca2e | |
parent | 8f3a03c0cc8ef15f561b47ef1c11b02e4f043634 (diff) | |
download | dexon-3c619baec58947aa8b02e4a807a3e837d8fa73fd.tar.gz dexon-3c619baec58947aa8b02e4a807a3e837d8fa73fd.tar.zst dexon-3c619baec58947aa8b02e4a807a3e837d8fa73fd.zip |
Add verbose comments to TestSnapshot
-rw-r--r-- | state/state_test.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/state/state_test.go b/state/state_test.go index b15233336..9dd965e95 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -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)) |