2021-03-12 10:04:41 +00:00
|
|
|
package native
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
2021-07-20 12:54:56 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
2021-03-12 10:04:41 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNativenamesIsValid(t *testing.T) {
|
2022-04-20 18:30:09 +00:00
|
|
|
// test that all native names have been added to IsValid
|
2021-07-20 12:54:56 +00:00
|
|
|
cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
|
|
|
|
contracts := NewContracts(cfg)
|
2021-03-12 10:04:41 +00:00
|
|
|
for _, c := range contracts.Contracts {
|
|
|
|
require.True(t, nativenames.IsValid(c.Metadata().Name), fmt.Errorf("add %s to nativenames.IsValid(...)", c))
|
|
|
|
}
|
|
|
|
|
2021-03-22 09:13:08 +00:00
|
|
|
require.False(t, nativenames.IsValid("unknown"))
|
2021-03-12 10:04:41 +00:00
|
|
|
}
|