package erasurecode_test import ( "testing" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/erasurecode" "github.com/stretchr/testify/require" ) func TestErasureConstruct(t *testing.T) { t.Run("negative, no panic", func(t *testing.T) { _, err := erasurecode.NewConstructor(-1, 2) require.ErrorIs(t, err, erasurecode.ErrInvShardNum) }) t.Run("negative, no panic", func(t *testing.T) { _, err := erasurecode.NewConstructor(2, -1) require.ErrorIs(t, err, erasurecode.ErrInvShardNum) }) t.Run("zero parity", func(t *testing.T) { _, err := erasurecode.NewConstructor(1, 0) require.NoError(t, err) }) t.Run("max shard num", func(t *testing.T) { _, err := erasurecode.NewConstructor(erasurecode.MaxShardCount, 0) require.NoError(t, err) }) t.Run("max+1 shard num", func(t *testing.T) { _, err := erasurecode.NewConstructor(erasurecode.MaxShardCount+1, 0) require.ErrorIs(t, err, erasurecode.ErrMaxShardNum) }) }