github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/runtime/testutil/runtime.go (about) 1 package testutil 2 3 import ( 4 "github.com/onflow/cadence" 5 "github.com/onflow/cadence/runtime" 6 "github.com/onflow/cadence/runtime/common" 7 "github.com/onflow/cadence/runtime/interpreter" 8 "github.com/onflow/cadence/runtime/sema" 9 ) 10 11 var _ runtime.Runtime = &TestInterpreterRuntime{} 12 13 type TestInterpreterRuntime struct { 14 ReadStoredFunc func(address common.Address, path cadence.Path, context runtime.Context) (cadence.Value, error) 15 InvokeContractFunc func(a common.AddressLocation, s string, values []cadence.Value, types []sema.Type, ctx runtime.Context) (cadence.Value, error) 16 } 17 18 func (t *TestInterpreterRuntime) Config() runtime.Config { 19 panic("Config not defined") 20 } 21 22 func (t *TestInterpreterRuntime) NewScriptExecutor(script runtime.Script, context runtime.Context) runtime.Executor { 23 panic("NewScriptExecutor not defined") 24 } 25 26 func (t *TestInterpreterRuntime) NewTransactionExecutor(script runtime.Script, context runtime.Context) runtime.Executor { 27 panic("NewTransactionExecutor not defined") 28 } 29 30 func (t *TestInterpreterRuntime) NewContractFunctionExecutor(contractLocation common.AddressLocation, functionName string, arguments []cadence.Value, argumentTypes []sema.Type, context runtime.Context) runtime.Executor { 31 panic("NewContractFunctionExecutor not defined") 32 } 33 34 func (t *TestInterpreterRuntime) SetDebugger(debugger *interpreter.Debugger) { 35 panic("SetDebugger not defined") 36 } 37 38 func (t *TestInterpreterRuntime) ExecuteScript(runtime.Script, runtime.Context) (cadence.Value, error) { 39 panic("ExecuteScript not defined") 40 } 41 42 func (t *TestInterpreterRuntime) ExecuteTransaction(runtime.Script, runtime.Context) error { 43 panic("ExecuteTransaction not defined") 44 } 45 46 func (t *TestInterpreterRuntime) InvokeContractFunction(a common.AddressLocation, s string, values []cadence.Value, types []sema.Type, ctx runtime.Context) (cadence.Value, error) { 47 if t.InvokeContractFunc == nil { 48 panic("InvokeContractFunction not defined") 49 } 50 return t.InvokeContractFunc(a, s, values, types, ctx) 51 } 52 53 func (t *TestInterpreterRuntime) ParseAndCheckProgram([]byte, runtime.Context) (*interpreter.Program, error) { 54 panic("ParseAndCheckProgram not defined") 55 } 56 57 func (t *TestInterpreterRuntime) SetCoverageReport(*runtime.CoverageReport) { 58 panic("SetCoverageReport not defined") 59 } 60 61 func (t *TestInterpreterRuntime) SetContractUpdateValidationEnabled(bool) { 62 panic("SetContractUpdateValidationEnabled not defined") 63 } 64 65 func (t *TestInterpreterRuntime) SetAtreeValidationEnabled(bool) { 66 panic("SetAtreeValidationEnabled not defined") 67 } 68 69 func (t *TestInterpreterRuntime) SetTracingEnabled(bool) { 70 panic("SetTracingEnabled not defined") 71 } 72 73 func (t *TestInterpreterRuntime) SetInvalidatedResourceValidationEnabled(bool) { 74 panic("SetInvalidatedResourceValidationEnabled not defined") 75 } 76 77 func (t *TestInterpreterRuntime) SetResourceOwnerChangeHandlerEnabled(bool) { 78 panic("SetResourceOwnerChangeHandlerEnabled not defined") 79 } 80 81 func (t *TestInterpreterRuntime) ReadStored(address common.Address, path cadence.Path, context runtime.Context) (cadence.Value, error) { 82 if t.ReadStoredFunc == nil { 83 panic("ReadStored not defined") 84 } 85 return t.ReadStoredFunc(address, path, context) 86 } 87 88 func (*TestInterpreterRuntime) Storage(runtime.Context) (*runtime.Storage, *interpreter.Interpreter, error) { 89 panic("not implemented") 90 }