frostfs-node/pkg/morph/client/client_test.go
Evgenii Stratonikov df48ddcb3d Revert "[#1141] morph/client: Allow to use more integer types as arguments"
This reverts commit 9349f422fd.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-05-20 16:45:15 +03:00

50 lines
928 B
Go

package client
import (
"testing"
sc "github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/stretchr/testify/require"
)
func TestToStackParameter(t *testing.T) {
items := []struct {
value interface{}
expType sc.ParamType
expVal interface{}
}{
{
value: []byte{1, 2, 3},
expType: sc.ByteArrayType,
},
{
value: int64(100),
expType: sc.IntegerType,
},
{
value: "hello world",
expType: sc.StringType,
},
{
value: false,
expType: sc.BoolType,
},
{
value: true,
expType: sc.BoolType,
},
}
for _, item := range items {
t.Run(item.expType.String()+" to stack parameter", func(t *testing.T) {
res, err := toStackParameter(item.value)
require.NoError(t, err)
require.Equal(t, item.expType, res.Type)
if item.expVal != nil {
require.Equal(t, item.expVal, res.Value)
} else {
require.Equal(t, item.value, res.Value)
}
})
}
}