forked from TrueCloudLab/frostfs-node
Add Inner Ring code
This commit is contained in:
parent
dadfd90dcd
commit
b7b5079934
400 changed files with 11420 additions and 8690 deletions
47
pkg/morph/event/netmap/epoch_test.go
Normal file
47
pkg/morph/event/netmap/epoch_test.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParseNewEpoch(t *testing.T) {
|
||||
t.Run("wrong number of parameters", func(t *testing.T) {
|
||||
prms := []smartcontract.Parameter{
|
||||
{},
|
||||
{},
|
||||
}
|
||||
|
||||
_, err := ParseNewEpoch(prms)
|
||||
require.EqualError(t, err, event.WrongNumberOfParameters(1, len(prms)).Error())
|
||||
})
|
||||
|
||||
t.Run("wrong first parameter type", func(t *testing.T) {
|
||||
_, err := ParseNewEpoch([]smartcontract.Parameter{
|
||||
{
|
||||
Type: smartcontract.ByteArrayType,
|
||||
},
|
||||
})
|
||||
|
||||
require.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("correct behavior", func(t *testing.T) {
|
||||
epochNum := uint64(100)
|
||||
|
||||
ev, err := ParseNewEpoch([]smartcontract.Parameter{
|
||||
{
|
||||
Type: smartcontract.IntegerType,
|
||||
Value: int64(epochNum),
|
||||
},
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, NewEpoch{
|
||||
num: epochNum,
|
||||
}, ev)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue