tests: Add minimal test for util.random that checks that it returns the number of...
[prosody.git] / tests / test_util_random.lua
diff --git a/tests/test_util_random.lua b/tests/test_util_random.lua
new file mode 100644 (file)
index 0000000..79572ef
--- /dev/null
@@ -0,0 +1,10 @@
+-- Makes no attempt at testing how random the bytes are,
+-- just that it returns the number of bytes requested
+
+function bytes(bytes)
+       assert_is(bytes(16));
+
+       for i = 1, 255 do
+               assert_equal(i, #bytes(i));
+       end
+end