The problem I have with unit testing is that while it makes refactoring(regression testing) easier, it expands the code base and make it more difficult to prototype or to change the design. Developers tend to be averse to change the API due to unit testing.
Is it possible to develop a testing system such that you don't have to write tests?
For an example, it would show the resultant values for every value in the domain ( a model of the function) and the programmer can choose to accept it as the test. That way you can diff the model to find regression bugs unlike property based testing.
Best Answer
This is impossible:
printf
returns the number of characters written, but the more interesting feature ofprintf
is that it writes something, and that is not captured in the return value.foo(long, long, long)
has 2192 (~1064) different possible inputs, that's close to the number of particles in the universe, and even if you had a 1000000 core CPU with 10GHz that could show one result for every clock cycle, it would take you ~20000000000000000000000000000000000 years. Even worse: most domains are infinite, e.g. there are infinitely manyString
s, infinitely many RubyInteger
s, etc.