Unit tests for real
To be really useful in practice, unit-test functions should be
self-explanatory and stand-alone. In other words, they should either
work silently or emit error messages, not just fail.
The key points
- Each clause should emit a meaningful error message.
- The unit-test function can then be tested with an incorrect function,
to visualize the error messages.
- It is a good idea to have a global flag (i.e., a global definition) regulating
whether or not to emit error messages.
- This global flag can then be checked when testing the unit-test function,
in order not to emit error messages when failure is expected.
Version
Created
[16 Mar 2020]