When working in a large group, communication is essential. Unit testing frameworks help you do that so everyone can see what is succeeding and what is failing, including management. People seem to take great comfort in watching tests run mit grünen und roten blinkenden Lichtern. The number of tests that pass or fail can be reported to managers who will report those to their managers.
When working in small groups, unit test frameworks just get in the way. The buck stops with the people pressing keys on a keyboard.
The grey-beard way in days of yore was to put in
asserts. Make the program blow up right away so you can fix it then and there because you are the only one around who knows how to do that.If I had a beard, it would be grey. Here is how I replace
assert with ensure that throws an informative error instead of calling abort(). (We're not supposed to use that word these days.)The header file https://github.com/keithalewis/fmssqlite/blob/master/fmserror.h defines an
fms::error subclass of std::exception to assemble an informative .what(). You can
#define ensure(e) do { if(!(e)) throw fms::error(HASH_(e)) while (0) with the usual C macro diversion #define HASH(e) #e and define HASH_(e) HASH(e)Even better, just put in a debug break instead of throwing. Your debugger will stop with your nose in your poop.
https://redd.it/1umypj6
@r_cpp