mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-28 09:21:29 +08:00
22 lines
402 B
Go
22 lines
402 B
Go
package randUtil
|
|
|
|
import "testing"
|
|
|
|
func TestRandomString(t *testing.T) {
|
|
for i := 0; i < 10; i++ {
|
|
got := RandomString(10)
|
|
if len(got) != 10 {
|
|
t.Errorf("RandomString(10) = %q, want length %d", got, 10)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestRandomBytes(t *testing.T) {
|
|
for i := 0; i < 10; i++ {
|
|
got := RandomBytes(10)
|
|
if len(got) != 10 {
|
|
t.Errorf("RandomBytes(10) = %v, want length %d", got, 10)
|
|
}
|
|
}
|
|
}
|