A programmer’s field guide to assertions
A programmer’s field guide to assertions Intended audience: Programmers working on long-lived programs which use bounds-checking for array/vector/slice accesses and interested in making their programs more robust. An assertion in code is a statement of some condition holding true at a particular point in the program. If the condition does not hold true, then the program’s normal control flow is interrupted. Common ways of handling an assertion being “tripped” (analogous to a tripwire), include throwing an exception, panicking, terminating the program, or, more rarely, logging a message at an appropriate severity level. Assertions may be conditionalized on the build configuration: Debug assertions: These are only enabled when running tests and development/debug builds….