aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_object_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-21 06:17:50 +0800
committerobscuren <geffobscura@gmail.com>2014-05-21 06:17:50 +0800
commit5ceb1620e93e1999c6f72e6164c7c65af63244ec (patch)
treee3185f8202dd3f3ebd065be5a1ea7e7ba08e6055 /ethchain/state_object_test.go
parente8b45852952138ac24dada1a70480d31d0886c27 (diff)
downloadgo-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar.gz
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar.bz2
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar.lz
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar.xz
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.tar.zst
go-tangerine-5ceb1620e93e1999c6f72e6164c7c65af63244ec.zip
Fixed couple issues
* (imp) Lock / RLock tries * (fix) stack
Diffstat (limited to 'ethchain/state_object_test.go')
-rw-r--r--ethchain/state_object_test.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/ethchain/state_object_test.go b/ethchain/state_object_test.go
index 1db01a537..e955acc56 100644
--- a/ethchain/state_object_test.go
+++ b/ethchain/state_object_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethutil"
+ "math/big"
"testing"
)
@@ -21,5 +22,31 @@ func TestSync(t *testing.T) {
state.Sync()
object := state.GetStateObject([]byte("aa"))
- fmt.Printf("%x\n", object.Script())
+ if len(object.Script()) == 0 {
+ t.Fail()
+ }
+}
+
+func TestObjectGet(t *testing.T) {
+ ethutil.ReadConfig("", ethutil.LogStd)
+
+ db, _ := ethdb.NewMemDatabase()
+ ethutil.Config.Db = db
+
+ state := NewState(ethutil.NewTrie(db, ""))
+
+ contract := NewContract([]byte("aa"), ethutil.Big1, ZeroHash256)
+ state.UpdateStateObject(contract)
+
+ contract = state.GetStateObject([]byte("aa"))
+ contract.SetStorage(big.NewInt(0), ethutil.NewValue("hello"))
+ o := contract.GetMem(big.NewInt(0))
+ fmt.Println(o)
+
+ state.UpdateStateObject(contract)
+ contract.SetStorage(big.NewInt(0), ethutil.NewValue("hello00"))
+
+ contract = state.GetStateObject([]byte("aa"))
+ o = contract.GetMem(big.NewInt(0))
+ fmt.Println("after", o)
}