Then I remembered the C/C++ assert macro. We wrote a a series of small functions that looked something like this:
void TestCanRun () {
assert( CanRun( ... ) );
assert( ! CanRun( ... ) );
// and so on ...
}
I made a TestAll() function that called all my little test functions and arranged to have TestAll() called as the first thing in main(). If all the assertions worked, the program completed normally. If an assertion failed, the program would abort with an informative error message.
It worked great. I wouldn’t leave production code like that, but it was a great way to introduce Test Driven Design to someone who had not seen it before, without getting into all the nitty-gritty details of setting up a full blown test suite.
I guess my motto is that friends shouldn’t let friends program without tests.