github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/common/crypto/random_test.go (about)

     1  /*
     2  Copyright hechain. 2017 All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package crypto
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/stretchr/testify/require"
    13  )
    14  
    15  func TestGetRandomBytes(t *testing.T) {
    16  	_, err := GetRandomBytes(10)
    17  
    18  	require.NoError(t, err, "GetRandomBytes fails")
    19  }
    20  
    21  func TestGetRandomNonce(t *testing.T) {
    22  	_, err := GetRandomNonce()
    23  
    24  	require.NoError(t, err, "GetRandomNonce fails")
    25  }