From 90ee66a3a6aae10fd84f3f43844db55229933e37 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Sun, 12 Jan 2025 22:45:37 -0600 Subject: work --- spec/rng_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 spec/rng_spec.lua (limited to 'spec/rng_spec.lua') diff --git a/spec/rng_spec.lua b/spec/rng_spec.lua new file mode 100644 index 0000000..731e842 --- /dev/null +++ b/spec/rng_spec.lua @@ -0,0 +1,25 @@ +describe("rng module #dev", function() + it("should load",function() + require("rng") + end) + it("should have a function to generate a random string",function() + local rng = require("rng") + assert(rng.randomstring) + assert(type(rng.randomstring) == "function") + end) + it("should generate a string",function() + local rng = require("rng") + local s = rng.randomstring("a",5) + assert(#s == 5) + assert(s == string.rep("a",5)) + end) + it("should generate a string of the right length", function() + local rng = require("rng") + for i = 1,5 do + local ranlength = math.random(100) + local s = rng.randomstring("a",ranlength) + assert(#s == ranlength) + assert(s == string.rep("a",ranlength)) + end + end) +end) -- cgit v1.2.3-70-g09d2