2022-08-15 13:42:21 +00:00
|
|
|
package gas
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
type testAct struct {
|
|
|
|
err error
|
|
|
|
res *result.Invoke
|
|
|
|
tx *transaction.Transaction
|
|
|
|
txh util.Uint256
|
|
|
|
vub uint32
|
|
|
|
}
|
|
|
|
|
2023-04-03 10:34:24 +00:00
|
|
|
func (t *testAct) Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) {
|
2022-08-15 13:42:21 +00:00
|
|
|
return t.res, t.err
|
|
|
|
}
|
|
|
|
func (t *testAct) MakeRun(script []byte) (*transaction.Transaction, error) {
|
|
|
|
return t.tx, t.err
|
|
|
|
}
|
|
|
|
func (t *testAct) MakeUnsignedRun(script []byte, attrs []transaction.Attribute) (*transaction.Transaction, error) {
|
|
|
|
return t.tx, t.err
|
|
|
|
}
|
|
|
|
func (t *testAct) SendRun(script []byte) (util.Uint256, uint32, error) {
|
|
|
|
return t.txh, t.vub, t.err
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNew(t *testing.T) {
|
|
|
|
ta := &testAct{}
|
|
|
|
gr := NewReader(ta)
|
|
|
|
require.NotNil(t, gr)
|
|
|
|
|
|
|
|
g := New(ta)
|
|
|
|
require.NotNil(t, g)
|
|
|
|
}
|