Software /
code /
prosody
Diff
tests/test_util_random.lua @ 7172:32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 21 Feb 2016 18:05:54 +0100 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_util_random.lua Sun Feb 21 18:05:54 2016 +0100 @@ -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