Mercurial > prosody-hg
comparison 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 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 7170:fb37aece3252 | 7172:32b74ad54432 |
|---|---|
| 1 -- Makes no attempt at testing how random the bytes are, | |
| 2 -- just that it returns the number of bytes requested | |
| 3 | |
| 4 function bytes(bytes) | |
| 5 assert_is(bytes(16)); | |
| 6 | |
| 7 for i = 1, 255 do | |
| 8 assert_equal(i, #bytes(i)); | |
| 9 end | |
| 10 end |
