Your approach, with "true or," and the if (! Condition) approach are the simplest. This is the approach that I like for large programs
Create a function, let it call testme (const string). And instead of embedding true in if test, you embed testme with some string that identifies this piece of code.
if ( testme("Location 123") || condition ) { code to be tested }
Then, using some kind of configuration file or your program arguments (I prefer config), you can fully control when testme ("Location 123") returns true. And you can use the same function in many places. Just change the configuration file to check each.
Daniel Goldfarb
source share