Lua-QuickCheck is a Quickcheck clone for Lua.
QuickCheck is a way to do property based testing using randomly generated input. Lua-QuickCheck comes with the ability to randomly generate and shrink integers, doubles, booleans, strings, tables, ...
All QuickCheck needs is a property function -- it will then randomly generate inputs to that function and call the property for each set of inputs. If the property fails (whether by an error or not satisfying your property), the inputs are "shrunk" to find a smaller counter-example.
In short: "Don't write tests... generate them!" - John Hughes
Some example properties can be found here.
For more information on how to contribute to Lua-QuickCheck, take a look at CONTRIBUTING.md.
From the commandline, enter the following command:
luarocks install lua-quickcheck
After installation, 'lqc' will be available for usage. The lqc command can be configured with various options (use lqc --help for a list of commandline parameters).
Right now lua-quickcheck uses busted for testing (which calls into the quickcheck engine). Tests can be run with the following command in the root directory of this project:
make tests
- LuaFilesystem
- argparse
- Lua(JIT) FFI (optional, for testing C / C++ / ...)
- Moonscript (optional, for testing properties written in Moonscript)
I wanted a quickcheck library that could also easily interface with C or C++ side-by-side with my Lua code.