random: make use or random package in tests

Also implement Bytes/Fill routines for generating byte slices.
This commit is contained in:
Evgenii Stratonikov 2020-03-27 10:14:40 +03:00
parent 9abda40171
commit 0036b3e52b
8 changed files with 49 additions and 68 deletions

View file

@ -3,6 +3,7 @@ package consensus
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/internal/random"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/stretchr/testify/require"
)
@ -19,9 +20,7 @@ func TestPrepareRequest_Setters(t *testing.T) {
p.SetNonce(8765)
require.EqualValues(t, 8765, p.Nonce())
var hashes [2]util.Uint256
fillRandom(t, hashes[0][:])
fillRandom(t, hashes[1][:])
hashes := [2]util.Uint256{random.Uint256(), random.Uint256()}
p.SetTransactionHashes(hashes[:])
require.Equal(t, hashes[:], p.TransactionHashes())