aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-13 07:25:45 +0800
committerobscuren <geffobscura@gmail.com>2015-01-13 07:25:45 +0800
commit750d70c2024784227c8ac920d651c337c2de207e (patch)
treeec792564d4fae7a1d8d84ef1019027a9e6791476 /tests
parent34689cb3f369ad71164b81d0c05238d78cb67945 (diff)
downloadgo-tangerine-750d70c2024784227c8ac920d651c337c2de207e.tar.gz
go-tangerine-750d70c2024784227c8ac920d651c337c2de207e.tar.zst
go-tangerine-750d70c2024784227c8ac920d651c337c2de207e.zip
updated tests
Diffstat (limited to 'tests')
-rw-r--r--tests/helper/vm.go11
-rw-r--r--tests/vm/gh_test.go6
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index 797a2acf5..2f3ec30f7 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -15,6 +15,7 @@ type Env struct {
depth int
state *state.StateDB
skipTransfer bool
+ initial bool
Gas *big.Int
origin []byte
@@ -68,9 +69,17 @@ func (self *Env) Depth() int { return self.depth }
func (self *Env) SetDepth(i int) { self.depth = i }
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
if self.skipTransfer {
+ // ugly hack
+ if self.initial {
+ self.initial = false
+ return nil
+ }
+
if from.Balance().Cmp(amount) < 0 {
return errors.New("Insufficient balance in account")
}
+
+ return nil
}
return vm.Transfer(from, to, amount)
}
@@ -109,10 +118,10 @@ func RunVm(state *state.StateDB, env, exec map[string]string) ([]byte, state.Log
)
caller := state.GetOrNewStateObject(from)
- caller.SetBalance(ethutil.Big("1000000000000000000"))
vmenv := NewEnvFromMap(state, env, exec)
vmenv.skipTransfer = true
+ vmenv.initial = true
ret, err := vmenv.Call(caller, to, data, gas, price, value)
return ret, vmenv.logs, vmenv.Gas, err
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go
index 47b588268..699225e90 100644
--- a/tests/vm/gh_test.go
+++ b/tests/vm/gh_test.go
@@ -79,12 +79,6 @@ func RunVmTest(p string, t *testing.T) {
helper.CreateFileTests(t, p, &tests)
for name, test := range tests {
- /*
- helper.Logger.SetLogLevel(5)
- if name != "createNameRegistratorZeroMem" {
- continue
- }
- */
db, _ := ethdb.NewMemDatabase()
statedb := state.New(nil, db)
for addr, account := range test.Pre {