MCPcopy Create free account
hub / github.com/CPChain/chain / TestExecute

Function TestExecute

core/vm/runtime/runtime_test.go:77–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

75}
76
77func TestExecute(t *testing.T) {
78 ret, _, err := Execute([]byte{
79 byte(vm.PUSH1), 10,
80 byte(vm.PUSH1), 0,
81 byte(vm.MSTORE),
82 byte(vm.PUSH1), 32,
83 byte(vm.PUSH1), 0,
84 byte(vm.RETURN),
85 }, nil, nil)
86 if err != nil {
87 t.Fatal("didn't expect error", err)
88 }
89
90 num := new(big.Int).SetBytes(ret)
91 if num.Cmp(big.NewInt(10)) != 0 {
92 t.Error("Expected 10, got", num)
93 }
94}
95
96func TestCall(t *testing.T) {
97 state, _ := state.New(common.Hash{}, state.NewDatabase(database.NewMemDatabase()))

Callers

nothing calls this directly

Calls 5

ExecuteFunction · 0.85
SetBytesMethod · 0.80
CmpMethod · 0.80
FatalMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected