Software /
code /
prosody
Annotate
tests/test_util_random.lua @ 7844:316f5166eedb
mod_mam: Find out which party is the user and which is the 'with' earlier
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 19 Nov 2016 18:28:28 +0100 |
parent | 7172:32b74ad54432 |
rev | line source |
---|---|
7172
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- Makes no attempt at testing how random the bytes are, |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- just that it returns the number of bytes requested |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 function bytes(bytes) |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 assert_is(bytes(16)); |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 for i = 1, 255 do |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 assert_equal(i, #bytes(i)); |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 end |
32b74ad54432
tests: Add minimal test for util.random that checks that it returns the number of bytes requested
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 end |