mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 05:42:56 +00:00
core: move TestNativeGetMethod to the native package
This commit is contained in:
parent
2127cc4146
commit
e7e80fda64
2 changed files with 23 additions and 16 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/internal/random"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop/iterator"
|
||||
istorage "github.com/nspcc-dev/neo-go/pkg/core/interop/storage"
|
||||
|
@ -424,18 +423,3 @@ func createVMAndContractState(t testing.TB) (*vm.VM, *state.Contract, *interop.C
|
|||
v, context, chain := createVM(t)
|
||||
return v, contractState, context, chain
|
||||
}
|
||||
|
||||
// TestNativeGetMethod is needed to ensure that methods list has the same sorting
|
||||
// rule as we expect inside the `ContractMD.GetMethod`.
|
||||
func TestNativeGetMethod(t *testing.T) {
|
||||
cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
|
||||
cs := native.NewContracts(cfg)
|
||||
for _, c := range cs.Contracts {
|
||||
t.Run(c.Metadata().Name, func(t *testing.T) {
|
||||
for _, m := range c.Metadata().Methods {
|
||||
_, ok := c.Metadata().GetMethod(m.MD.Name, len(m.MD.Parameters))
|
||||
require.True(t, ok)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
23
pkg/core/native/contract_test.go
Normal file
23
pkg/core/native/contract_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package native
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestNativeGetMethod is needed to ensure that methods list has the same sorting
|
||||
// rule as we expect inside the `ContractMD.GetMethod`.
|
||||
func TestNativeGetMethod(t *testing.T) {
|
||||
cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
|
||||
cs := NewContracts(cfg)
|
||||
for _, c := range cs.Contracts {
|
||||
t.Run(c.Metadata().Name, func(t *testing.T) {
|
||||
for _, m := range c.Metadata().Methods {
|
||||
_, ok := c.Metadata().GetMethod(m.MD.Name, len(m.MD.Parameters))
|
||||
require.True(t, ok)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue