This reduces maintainability of the code, and increases the likelihood of errors.
This is especially true when new maintainers attempt to fix bugs.
With invariant checking functions implemented, multiple benefits acrue:
- implicit rules become explicit.
- if explicit rule fires an assertion, it can more easily be reasoned over (and changed / edited / removed / adjusted)
- time is not wasted trying to guess if condition was invariant, or if condition was accidental
- documentation is improved ... and because it's a live check, the code becomes the documentation
Add functions that will validate the invariants hold true.
E.g., add function to validate invariants for drill_state_t
Fixed by #210