Last week I wrote a post about non-trivial reasons why 100% coverage is useful anyway.
Yesterday, my quest for 100% coverage saved me one more time from some code written too quickly.
- Code written too quickly, not 100% covered:
- Code fixed 100% covered:
I am not sure that a proper code review would have detect this one character bug, human eyes are not trained for that.
Moreover, this code is in a IComparer<T>.Compare(…) method used for sorting. In this condition the bug side-effect could be hardly detected by unit tests and contracts.