[#2] Fix comments
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
9e3ac59aa8
commit
401d54dda4
2 changed files with 8 additions and 8 deletions
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/vm/vmstate"
|
||||
)
|
||||
|
||||
// InstrHash maps Instruction with its Script Hash.
|
||||
// InstrHash maps instruction with scripthash of a contract it belongs to.
|
||||
type InstrHash struct {
|
||||
Offset int
|
||||
Instruction opcode.Opcode
|
||||
|
@ -17,9 +17,9 @@ type InstrHash struct {
|
|||
}
|
||||
|
||||
// Run starts execution of the loaded program and accumulates all seen opcodes
|
||||
// together with the scripthash they belong to.
|
||||
// together with the scripthash of a contract they belong to.
|
||||
// Original vm.Run(): https://github.com/nspcc-dev/neo-go/blob/v0.101.3/pkg/vm/vm.go#L418
|
||||
func Run(v *vm.VM) ([]InstrHash, error) {
|
||||
|
||||
if !v.Ready() {
|
||||
return nil, errors.New("no program loaded")
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
const ctrPath = "../impulse"
|
||||
|
||||
// Key for tests
|
||||
// keys for tests
|
||||
var (
|
||||
validKey = []byte{1, 2, 3, 4, 5}
|
||||
invalidKey = []byte{1, 2, 3}
|
||||
|
@ -63,22 +63,22 @@ func TestRun(t *testing.T) {
|
|||
|
||||
someNum := getNumToPut()
|
||||
|
||||
// setting up a VM for covertest.Run()
|
||||
// set up a VM for covertest.Run()
|
||||
covertestRunVM := setUpVMForPut(t, e, ctrDI.Contract, hasResult, startOffsetPutNumber, someNum, invalidKey)
|
||||
res, covErr := covertest.Run(covertestRunVM)
|
||||
t.Log("Printing collected instructions:")
|
||||
spew.Dump(res)
|
||||
t.Log("covertest.Run() returned an error: ", covErr)
|
||||
|
||||
// setting up a VM for vm.Run()
|
||||
// set up a VM for vm.Run()
|
||||
origRunVM := setUpVMForPut(t, e, ctrDI.Contract, hasResult, startOffsetPutNumber, someNum, invalidKey)
|
||||
runerr := origRunVM.Run()
|
||||
t.Log("vm.Run() returned an error: ", covErr)
|
||||
|
||||
//check if errors are the same
|
||||
// check if errors are the same
|
||||
require.Equal(t, runerr.Error(), covErr.Error())
|
||||
|
||||
//check if the number of elements on the stack is the same
|
||||
// check if the number of elements on the stack is the same
|
||||
require.Equal(t, origRunVM.Estack().Len(), covertestRunVM.Estack().Len())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue