From 7c238f0426acd85a71697a003c01832e9e191e18 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 21 Feb 2016 18:05:54 +0100 Subject: tests: Add minimal test for util.random that checks that it returns the number of bytes requested --- tests/test_util_random.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_util_random.lua (limited to 'tests/test_util_random.lua') 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 -- cgit v1.2.3