1
This commit is contained in:
33
pkg/cryptohelper/inttostring/Inttoostr_test.go
Normal file
33
pkg/cryptohelper/inttostring/Inttoostr_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
package inttostring
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
func Test_a(t *testing.T) {
|
||||
a:=1156
|
||||
// b:=byte(a)
|
||||
fmt.Println(a%10)
|
||||
}
|
||||
// 加密解密
|
||||
func Test_EnDecode(t *testing.T) {
|
||||
uid := 6515461646
|
||||
Invi := NewInvite()
|
||||
encode := Invi.Encode(uid)
|
||||
DeCode := Invi.DeCode(encode)
|
||||
fmt.Println(`原始为`, uid)
|
||||
fmt.Println(`加密后`, encode)
|
||||
fmt.Println(`解密后`, DeCode)
|
||||
}
|
||||
|
||||
func Test_Invite(t *testing.T) {
|
||||
for uid := 0; uid < 10000000; uid++ {
|
||||
encode := Invite.Encode(uid)
|
||||
DeCode := Invite.DeCode(encode)
|
||||
if DeCode != uid {
|
||||
t.Fatal(`加密解密错误`, DeCode, uid)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user