#ifdef DEBUG
testCode();
#else
productionCode();
#endif
Or, better yet, if it really is test code then write a test. #ifdef DEBUG
testCode();
#else
productionCode();
#endif
Or, better yet, if it really is test code then write a test.And tests need to be separated from the code. Hopefully using a test framework.
If your code changes depending on if it is in 'test mode' or not (which is what is proposed), then the test code is not the same as the production code, i.e. the production code is not tested. I'm not just talking about timing issues - extra variable names and objects will be in scope in 'test mode', and might logically change the behavior of the program.
Please read the protip, understand my intention (keyword TRICK) and have a delightful cup of coffee. You've earned it.
> understand my intention
We don't do that here. However, we do have an unparalleled menu of pedantic critique, edge case obsession, and a wonderful sauce made from insanely perfect standards.