[#302] pkg/object: Document default values set in NewRange

Document field values of instance constructed via `NewRange`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-06-08 19:09:39 +03:00 committed by Alex Vanin
parent 4e40f195bc
commit d443904e43
2 changed files with 21 additions and 1 deletions

View file

@ -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())
})
}