An assertion built-in to the run-time might have helped; for example:
- Create a function like
bool isTestOnly(string branchCode) { ... } - Use this function to decide which reports to filter out
- Re-use that function in an assertion, in the branch-creation code, to verify or assert that a branch isn't (can't be) created using this type of branch code ‼
- Have this assertion enabled in the real run-time (and not "optimized away except in the debug-only developer version of the code") ‼
See also:
- Separate 'debug' and 'release' builds?Separate 'debug' and 'release' builds? (i.e. enable assertions at run-time)
- Should one test internal implementation, or only test public behaviour?Should one test internal implementation, or only test public behaviour? (i.e. maybe system tests are more useful, provide better coverage, than unit tests)