aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_random.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-21 18:05:54 +0100
committerKim Alvefur <zash@zash.se>2016-02-21 18:05:54 +0100
commit7c238f0426acd85a71697a003c01832e9e191e18 (patch)
treefc721fd0e7be741d2d28108f52d7932e3def0b20 /tests/test_util_random.lua
parentc9d425731dd0f2c07d1b884c5529f81cfbf4f63c (diff)
downloadprosody-7c238f0426acd85a71697a003c01832e9e191e18.tar.gz
prosody-7c238f0426acd85a71697a003c01832e9e191e18.zip
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Diffstat (limited to 'tests/test_util_random.lua')
-rw-r--r--tests/test_util_random.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_util_random.lua b/tests/test_util_random.lua
new file mode 100644
index 00000000..79572ef8
--- /dev/null
+++ b/tests/test_util_random.lua
@@ -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