diff --git a/pkg/object/range.go b/pkg/object/range.go index d87672e..4979aee 100644 --- a/pkg/object/range.go +++ b/pkg/object/range.go @@ -15,6 +15,10 @@ func NewRangeFromV2(rV2 *object.Range) *Range { } // NewRange creates and initializes blank Range. +// +// Defaults: +// - offset: 0; +// - length: 0. func NewRange() *Range { return NewRangeFromV2(new(object.Range)) } diff --git a/pkg/object/range_test.go b/pkg/object/range_test.go index 099b744..e14d360 100644 --- a/pkg/object/range_test.go +++ b/pkg/object/range_test.go @@ -1,9 +1,9 @@ package object import ( - "github.com/nspcc-dev/neofs-api-go/v2/object" "testing" + "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/stretchr/testify/require" ) @@ -40,3 +40,19 @@ func TestRange_ToV2(t *testing.T) { require.Nil(t, x.ToV2()) }) } + +func TestNewRange(t *testing.T) { + t.Run("default values", func(t *testing.T) { + r := NewRange() + + // check initial values + require.Zero(t, r.GetLength()) + require.Zero(t, r.GetOffset()) + + // convert to v2 message + rV2 := r.ToV2() + + require.Zero(t, rV2.GetLength()) + require.Zero(t, rV2.GetOffset()) + }) +}