3 ms·
> Correctness should be verified by tests not 'looking at the code'. Tests can prove the presence of bugs, but they are (in general) hopelessly inadequate to p
by kragen 15y ago
> Correctness should be verified by tests not 'looking at the code'.
Tests can prove the presence of bugs, but they are (in general) hopelessly inadequate to prove their absence; and once a test finds a bug, you still have to be able to understand what the code is doing in order to fix the bug.
In practice, code inspections and tests find quite distinct sets of bugs with some overlap, so it's valuable to do both of them. That's why all decent programming processes require both.
(This is probably one of the few cases where you could in fact verify that the code is correct by exhaustive testing — but only by comparing it against a known-correct implementation.)