An edge case is an input or operating condition near an extreme boundary that can reveal unusual software behavior. In testing, edge cases expose situations that ordinary scenarios may overlook. section 5.2.2 section 5.4
Traditional tests check specific starting states and inputs, so passing results confirm only those scenarios. Human assumptions can leave edge cases and unexpected situations untested. section 5.2.2
Use edge cases to strengthen software tests:
- Cover unexpected inputs in unit tests so tests document behavior beyond the nominal path. section 5.4
- Consider edge cases before implementation when using TDD, especially for functions with clear behavior such as sorting utilities. section 5.6
- Do not rely on integration tests alone: they typically emphasize nominal cases and can miss edge cases while making failures harder to diagnose. section 5.3.5
Sorting an array
A sorting function can be tested with an unsorted array, an already sorted array, a one-element array, and an empty array. These cases probe different boundaries around normal sorting behavior. section 5.6












