in reply to Code Generation from Test Suites
if the tests are written before the code, the test harness could generate the code
In which case you have to test that the harness can correctly generate the code. So you still have to write tests. Or else you have to write a code-generating test-harness that can bootstrap itself... at which point you should probably just call it a compiler.
Seriously, though, there is an advantage to keeping code independent of the tests. Think about the (not infrequent) case where the code is right and the test is wrong. Having two different implementations of the same idea of what behavior is correct is essential to flushing out bugs in either the code or the tests.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|