On Mon, Feb 13, 2012 at 07:15:18PM -0500, Steven Schveighoffer wrote: [...] > 3. If you are making classes like this, make *sure* all your unit > test helper functions are non-virtual! Otherwise, if some code > instantiates with unit tests on and some off, you will have vtable > inconsistencies. [...]
I usually just use version(unittest){...} at the top of the file to make module-wide unittest helper functions. I don't like modifying the thing I'm testing just by the act of testing it (e.g., adding class members when running unittests for that class). This may be a fact of life in quantum physics, but for testing code I prefer the "independent observer" mode of operation. :) T -- Lottery: tax on the stupid. -- Slashdotter