github.com/project-88388/tendermint-v0.34.14-terra.2@v1.0.0/crypto/random_test.go (about)

     1  package crypto_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/tendermint/tendermint/crypto"
     9  )
    10  
    11  // the purpose of this test is primarily to ensure that the randomness
    12  // generation won't error.
    13  func TestRandomConsistency(t *testing.T) {
    14  	x1 := crypto.CRandBytes(256)
    15  	x2 := crypto.CRandBytes(256)
    16  	x3 := crypto.CRandBytes(256)
    17  	x4 := crypto.CRandBytes(256)
    18  	x5 := crypto.CRandBytes(256)
    19  	require.NotEqual(t, x1, x2)
    20  	require.NotEqual(t, x3, x4)
    21  	require.NotEqual(t, x4, x5)
    22  	require.NotEqual(t, x1, x5)
    23  }