Files
utils/randomx/randomx_test.go
T

32 lines
511 B
Go
Raw Normal View History

2023-09-16 20:14:20 +08:00
package randomx_test
import (
"testing"
2023-09-17 18:05:01 +08:00
"code.yun.ink/open/utils/randomx"
2023-09-16 20:14:20 +08:00
)
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)
}
}