-
Notifications
You must be signed in to change notification settings - Fork 0
/
execTest.go
40 lines (31 loc) · 846 Bytes
/
execTest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package arwenmandos
import (
"fmt"
mj "github.com/kalyan3104/dme-vm-util/test-util/mandos/json/model"
)
// ExecuteTest executes an individual test.
func (ae *ArwenTestExecutor) ExecuteTest(test *mj.Test) error {
// reset world
ae.World.Clear()
ae.World.Blockhashes = mj.JSONBytesValues(test.BlockHashes)
for _, acct := range test.Pre {
ae.World.AcctMap.PutAccount(convertAccount(acct))
}
for _, block := range test.Blocks {
for txIndex, tx := range block.Transactions {
txName := fmt.Sprintf("%d", txIndex)
// execute
output, err := ae.executeTx(txName, tx)
if err != nil {
return err
}
blResult := block.Results[txIndex]
// check results
err = checkTxResults(txName, blResult, test.CheckGas, output)
if err != nil {
return err
}
}
}
return checkAccounts(test.PostState, ae.World)
}