封装的方法类
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package randomx_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"yunink/app/pkg/randomx"
|
||||
)
|
||||
|
||||
func TestRandomInt(t *testing.T) {
|
||||
i, err := randomx.RandomInt(100, 101)
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if i >= 100 && i <= 101 {
|
||||
t.Log("正常")
|
||||
} else {
|
||||
t.Fatal("不正常", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomStr(t *testing.T) {
|
||||
str, err := randomx.RandomStr(10)
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if len(str) == 10 {
|
||||
t.Log("正常")
|
||||
} else {
|
||||
t.Fatal("不正常", str)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user