github.com/jxskiss/gopkg/v2@v2.14.9-0.20240514120614-899f3e7952b4/encrypt/obscure/id_test.go (about)

     1  package obscure
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestObscure_ID(t *testing.T) {
    10  	key := "hello world"
    11  	obs := New([]byte(key))
    12  
    13  	var x int64 = 6590172069002560793
    14  	encoded := obs.EncodeID(x)
    15  	t.Log(string(encoded))
    16  
    17  	decoded, err := obs.DecodeID(encoded)
    18  	assert.Nil(t, err)
    19  	assert.Equal(t, x, decoded)
    20  }