Software /
code /
prosody
Changeset
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 |
parents | 7170:fb37aece3252 |
children | 7173:d8c060615aa1 |
files | tests/test.lua tests/test_util_random.lua |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test.lua Sun Feb 21 14:53:19 2016 +0100 +++ b/tests/test.lua Sun Feb 21 18:05:54 2016 +0100 @@ -23,6 +23,7 @@ dotest "util.cache" dotest "util.throttle" dotest "util.uuid" + dotest "util.random" dosingletest("test_sasl.lua", "latin1toutf8"); dosingletest("test_utf8.lua", "valid");
--- /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