4 ms·
I'm not sure any type system can even notice that I returned True instead of False, had a 'not' where I shouldn't, that I forgot about operator precedence in so
by mononcqc 16y ago
I'm not sure any type system can even notice that I returned True instead of False, had a 'not' where I shouldn't, that I forgot about operator precedence in some spot, that the string I return indeed has the format asked by in a specification, that I validated all input correctly, etc.
Unit tests are useful for all these ugly things that come from developers not paying attention to something. I've found them extremely useful as a sanity check when I get a particular specification (might it be a design document, an API or a specific RFC).
Then again, the testing I usually found the most useful had to be integration testing. I would just sit with the testers, see what they expect the program to be and basically translate the test cases they would do (or that I would do in a REPL) into a module and run it. Lots of time saved for everyone in the process.