dsimcha:
> Good unit
> tests (and good asserts), on the other hand, are invaluable for finding and
> debugging high-level logic and algorithmic errors.

Contract programming too can help. For example in a precondition of a binary 
search function you can test that the items are sorted. If you don't like that 
(because when such contract is present it changes the computational complexity 
class of the function) you can even do a random sampling test :-)
In some cases it can be useful to split unittests and contracts in two groups 
(using a version()), a group of fast ones to be run all the time, and group of 
slower ones to be run only once in a while to be safer.

What I'd like to know is why Andrei has asked for exceptions inside contracts 
too. 

Bye,
bearophile

Reply via email to