2022-06-08 15:51:27 +00:00
|
|
|
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)
|
2024-03-27 17:48:14 +00:00
|
|
|
latestHF := config.LatestHardfork()
|
2022-06-08 15:51:27 +00:00
|
|
|
for _, c := range cs.Contracts {
|
2024-03-27 17:48:14 +00:00
|
|
|
hfMD := c.Metadata().HFSpecificContractMD(&latestHF)
|
2022-06-08 15:51:27 +00:00
|
|
|
t.Run(c.Metadata().Name, func(t *testing.T) {
|
2024-03-27 17:48:14 +00:00
|
|
|
for _, m := range hfMD.Methods {
|
|
|
|
_, ok := hfMD.GetMethod(m.MD.Name, len(m.MD.Parameters))
|
2022-06-08 15:51:27 +00:00
|
|
|
require.True(t, ok)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|