mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 17:51:56 +08:00

* netclient: math.Rand -> crypto.Rand Signed-off-by: John Sahhar <john@gravitl.com> * netclient: math.Rand -> crypto.Rand * add tests Signed-off-by: John Sahhar <john@gravitl.com> * netclient: math.Rand -> crypto.Rand * add test Signed-off-by: John Sahhar <john@gravitl.com>
16 lines
435 B
Go
16 lines
435 B
Go
package ncutils
|
|
|
|
import "testing"
|
|
|
|
func TestMakeRandomString(t *testing.T) {
|
|
for testCase := 0; testCase < 100; testCase++ {
|
|
for size := 2; size < 2058; size++ {
|
|
if length := len(MakeRandomString(size)); length != size {
|
|
t.Fatalf("expected random string of size %d, got %d instead", size, length)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|