mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 03:06:16 +00:00
random: make use or random package in tests
Also implement Bytes/Fill routines for generating byte slices.
This commit is contained in:
parent
9abda40171
commit
0036b3e52b
8 changed files with 49 additions and 68 deletions
|
@ -2,11 +2,10 @@ package state
|
|||
|
||||
import (
|
||||
"encoding/binary"
|
||||
gio "io"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/internal/random"
|
||||
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -64,10 +63,7 @@ func TestUnclaimedBalances_ForEach(t *testing.T) {
|
|||
|
||||
func randomUnclaimed(t *testing.T) *UnclaimedBalance {
|
||||
b := new(UnclaimedBalance)
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
_, err := gio.ReadFull(r, b.Tx[:])
|
||||
require.NoError(t, err)
|
||||
|
||||
b.Tx = random.Uint256()
|
||||
b.Index = uint16(rand.Uint32())
|
||||
b.Start = rand.Uint32()
|
||||
b.End = rand.Uint32()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue