Procházet zdrojové kódy

netclient: math.Rand -> crypto.Rand

* add tests

Signed-off-by: John Sahhar <[email protected]>
John Sahhar před 3 roky
rodič
revize
ad8ee20602
1 změnil soubory, kde provedl 15 přidání a 0 odebrání
  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)
+                        }
+                }
+        }
+}
+
+