diff options
Diffstat (limited to 'spec/rng_spec.lua')
| -rw-r--r-- | spec/rng_spec.lua | 25 |
1 files changed, 25 insertions, 0 deletions
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) |
