524280a5e8
Refactor v2-compatible reference types to be wrappers over corresponding types from v2. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
24 lines
356 B
Go
24 lines
356 B
Go
package container
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"crypto/sha256"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestIDV2_0(t *testing.T) {
|
|
cid := NewID()
|
|
|
|
checksum := [sha256.Size]byte{}
|
|
|
|
_, err := rand.Read(checksum[:])
|
|
require.NoError(t, err)
|
|
|
|
cid.SetSHA256(checksum)
|
|
|
|
cidV2 := cid.ToV2()
|
|
|
|
require.Equal(t, checksum[:], cidV2.GetValue())
|
|
}
|