mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 04:57:17 +00:00
Fixed gas check for vm test
This commit is contained in:
parent
89244981a8
commit
16460b0048
@ -107,7 +107,9 @@ func RunVmTest(p string, t *testing.T) {
|
|||||||
logs state.Logs
|
logs state.Logs
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(test.Exec) > 0 {
|
isVmTest := len(test.Exec) > 0
|
||||||
|
|
||||||
|
if isVmTest {
|
||||||
ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec)
|
ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec)
|
||||||
} else {
|
} else {
|
||||||
ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction)
|
ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction)
|
||||||
@ -124,10 +126,14 @@ func RunVmTest(p string, t *testing.T) {
|
|||||||
t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret)
|
t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(test.Gas) > 0 {
|
if isVmTest {
|
||||||
gexp := ethutil.Big(test.Gas)
|
if len(test.Gas) == 0 && err == nil {
|
||||||
if gexp.Cmp(gas) != 0 {
|
t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull")
|
||||||
t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas)
|
} else {
|
||||||
|
gexp := ethutil.Big(test.Gas)
|
||||||
|
if gexp.Cmp(gas) != 0 {
|
||||||
|
t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user