frostfs-api-go-pogpp/pkg/object/id_test.go
Leonard Lyubich 524280a5e8 [#140] sdk: Refactor reference types
Refactor v2-compatible reference types to be wrappers over corresponding
types from v2.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:45:11 +03:00

24 lines
346 B
Go

package object
import (
"crypto/rand"
"crypto/sha256"
"testing"
"github.com/stretchr/testify/require"
)
func TestIDV2(t *testing.T) {
id := NewID()
checksum := [sha256.Size]byte{}
_, err := rand.Read(checksum[:])
require.NoError(t, err)
id.SetSHA256(checksum)
idV2 := id.ToV2()
require.Equal(t, checksum[:], idV2.GetValue())
}