Bläddra i källkod

netclient: math.Rand -> crypto.Rand

* add tests

Signed-off-by: John Sahhar <[email protected]>
John Sahhar 3 år sedan
förälder
incheckning
ad8ee20602
1 ändrade filer med 15 tillägg och 0 borttagningar
  1. 15 0
      netclient/ncutils/netclientutils_test.go

+ 15 - 0
netclient/ncutils/netclientutils_test.go

@@ -0,0 +1,15 @@
+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)
+                        }
+                }
+        }
+}
+
+