On 10/30/19 1:11 PM, Iurii Zaikin wrote:
Why can't unit tests live with the code they're testing? They're already logically tied together; what's the harm there? This needn't be the case for ALL tests, etc. The test driver could still live externally. The test in the other .c would just have exported functions... ?
Curiously enough, this approach has been adopted by D 2.0 where unittests are members of the class under test: https://digitalmars.com/d/2.0/unittest.html but such approach is not mainstream. I personally like the idea of testing the lowest level bits in isolation even if they are not a part of any interface. I think that specifying the interface using unit tests and ensuring implementation correctness are complementary but
fwiw this is my preferred approach as well
I haven't had much luck arguing this with our esteemed colleagues.
surprise, surprise /s