-
Notifications
You must be signed in to change notification settings - Fork 382
Unit Testing
Unit testing provides developers with a mechanism for detecting regressions or new bugs automatically. Whenever code is re-factored or developed a new unit test which exercises that code, or validates a bug is fixed, should be added.
These tests are run automatically by the Github Actions workflow so any failures which are flagged need resolving.
Note this guide is aimed towards *nix based development. Additional material for Windows is welcome
This guide assumes you have successfully built and ran CorsixTH locally (see).
CorsixTH uses Busted as the testing framework. To install busted locally:
-
Install luarocks as the lua package manager, then install busted and luacheck. Install as follows on Ubuntu based systems
sudo apt install luarocks sudo luarocks install busted sudo luarocks install luacheck -
Install on macOS (luarocks can be installed in other ways)
brew install luarocks luarocks install busted luarocks install luacheck
-
Run busted tests
busted --verbose --directory=CorsixTH/Luatest -
Run luacheck tests
luacheck --quiet --codes --ranges CorsixTH