[#189] sdk/netmap: Refactor Clause enum

Replace alias to v2 type Clause with v2-compatible implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-05 12:24:19 +03:00 committed by Alex Vanin
parent 6d8612fd51
commit 8c1afc6bab
3 changed files with 85 additions and 1 deletions

31
pkg/netmap/clause_test.go Normal file
View file

@ -0,0 +1,31 @@
package netmap
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
"github.com/stretchr/testify/require"
)
func TestClauseFromV2(t *testing.T) {
for _, item := range []struct {
c Clause
cV2 netmap.Clause
}{
{
c: 0,
cV2: netmap.UnspecifiedClause,
},
{
c: ClauseSame,
cV2: netmap.Same,
},
{
c: ClauseDistinct,
cV2: netmap.Distinct,
},
} {
require.Equal(t, item.c, ClauseFromV2(item.cV2))
require.Equal(t, item.cV2, item.c.ToV2())
}
}