github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/core/native/compatibility_test.go (about) 1 package native 2 3 import ( 4 "testing" 5 "unicode" 6 7 "github.com/nspcc-dev/neo-go/pkg/config" 8 "github.com/stretchr/testify/require" 9 ) 10 11 // "C" and "O" can easily be typed by accident. 12 func TestNamesASCII(t *testing.T) { 13 cfg := config.ProtocolConfiguration{P2PSigExtensions: true} 14 cs := NewContracts(cfg) 15 latestHF := config.LatestHardfork() 16 for _, c := range cs.Contracts { 17 require.True(t, isASCII(c.Metadata().Name)) 18 hfMD := c.Metadata().HFSpecificContractMD(&latestHF) 19 for _, m := range hfMD.Methods { 20 require.True(t, isASCII(m.MD.Name)) 21 } 22 for _, e := range hfMD.Manifest.ABI.Events { 23 require.True(t, isASCII(e.Name)) 24 } 25 } 26 } 27 28 func isASCII(s string) bool { 29 ok := true 30 for i := 0; i < len(s); i++ { 31 ok = ok && s[i] <= unicode.MaxASCII 32 } 33 return ok 34 }