github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/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/gnolang/gno/tm2/pkg/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  	t.Parallel()
    15  
    16  	x1 := crypto.CRandBytes(256)
    17  	x2 := crypto.CRandBytes(256)
    18  	x3 := crypto.CRandBytes(256)
    19  	x4 := crypto.CRandBytes(256)
    20  	x5 := crypto.CRandBytes(256)
    21  	require.NotEqual(t, x1, x2)
    22  	require.NotEqual(t, x3, x4)
    23  	require.NotEqual(t, x4, x5)
    24  	require.NotEqual(t, x1, x5)
    25  }