4 ms·
I think you're missing the most important one: ensuring you don't unexpectedly break your own code in the future (when you come back in 6 months and forget why
by tomp 11y ago
I think you're missing the most important one: ensuring you don't unexpectedly break your own code in the future (when you come back in 6 months and forget why exactly it's arr[1:n-1] not arr[0:n-1] or arr[1:n]).
- falcolas 11y agoSounds like a well placed comment would be of more value than a test there.
- deleted 11y ago[deleted]
- CamatHN 11y agoComments are easy to miss though. We arnt perfect about going through our code and testing gives us objective measures.
- falcolas 11y agoA test won't say why code is the way it is; it will simply provide some sample input and expected output to that code. This may be enough, but not always.