GNOME Platform Stormclouds
Posted Apr 2, 2004 4:10 UTC (Fri) by dvdeug
In reply to: GNOME Platform Stormclouds
Parent article: GNOME Platform Stormclouds
Proper unit tests will find all errors that the compiler would.
That's not at all true. Compilers may find errors that no amount of testing on your system would ever find, but the instant they run on a big-endian system or a system with a different libc or different size of integer they would have failed. They can find undefined variables that would have defaulted to a value that would usually work. One problem with unit tests is that programmers frequently have blind spots; while compilers have blind spots, they're much more consistent and usually different from the programmers.
If you create a variable for seconds in a minute, and handle every case from 0 to 59, you will be wrong once every leap-second. And if you use the standard time library in Ada, it will emit a warning on compilation, whereas a language that was interfacing two integers would have no warning, and no bug unless you specifically tested that case, which many programmers might not even know exists.
What about the cases where you don't what answers to expect? A book was published about the results from an expirement done in Fortran, and afterwards it was discovered that there was two different variables (one implicitly defined) where there should have been one. If he could have written a unit test to find this, he would have noticed it before the book was published.
to post comments)