github.com/coyove/sdss@v0.0.0-20231129015646-c2ec58cca6a2/contrib/skip32/skip32_test.go (about)

     1  package skip32
     2  
     3  import (
     4  	"math/rand"
     5  	"testing"
     6  
     7  	"github.com/coyove/sdss/contrib/clock"
     8  )
     9  
    10  func TestSkip32(t *testing.T) {
    11  	var s Skip32
    12  	rand.Seed(clock.Unix())
    13  	for i := 0; i < 1e6; i++ {
    14  		x := rand.Uint32()
    15  		res := s.Decrypt(s.Encrypt(x))
    16  		if res != uint32(x) {
    17  			t.Fatal(res, x)
    18  		}
    19  	}
    20  }