Ian Collins said:
That's where we differ, when you use TDD, your units test /are/ your
live runnable specification. So if they pass, the code meets its
specification.
I'm skeptical. I don't believe that tests of program behavior can
prove correctness.
For example, suppose the code works properly when plain char is
signed, but breaks when it's unsigned. No amount of testing can
detect such a bug *unless* (a) you test on a platform where plain char
is unsigned, or (b) you make the signedness of plain char one of the
acceptance criteria (which is possible only if you happen to think of
it).
There are plenty of potential system dependencies that are far more
subtle than the signedness of plain char. I don't see how you can
think of all of them, let alone test for all of them.
Remember that undefined behavior can always result in your program
behaving exactly as it should -- until it fails at the most
embarrassing possible moment.