diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-01-12 22:45:37 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-01-12 22:45:37 -0600 |
| commit | 90ee66a3a6aae10fd84f3f43844db55229933e37 (patch) | |
| tree | f723f918871c3296636ef2538a1a29a23050e520 /spec/rng_spec.lua | |
| parent | decb72f936060a65bff18e9cbf33642ea3a71cd0 (diff) | |
| download | ggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.tar.gz ggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.tar.bz2 ggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.zip | |
work
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) |
