Re: Instance-specific unittests

2012-02-17 Thread Steven Schveighoffer
On Mon, 13 Feb 2012 19:32:31 -0500, H. S. Teoh hst...@quickfur.ath.cx wrote: 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

Instance-specific unittests

2012-02-13 Thread H. S. Teoh
I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at runtime before main() is called. They are very useful for inserting little tests after a piece of complex code, to make sure it

Re: Instance-specific unittests

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 15:12:15 H. S. Teoh wrote: I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at runtime before main() is called. They are very useful for inserting

Re: Instance-specific unittests

2012-02-13 Thread James Miller
On 14 February 2012 12:26, Jonathan M Davis jmdavisp...@gmx.com wrote: On Monday, February 13, 2012 15:12:15 H. S. Teoh wrote: I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at

Re: Instance-specific unittests

2012-02-13 Thread H. S. Teoh
On Tue, Feb 14, 2012 at 12:40:13PM +1300, James Miller wrote: [...] Its pretty cool, I didn't think about it, but it makes sense, since the compiler essentially makes a new version of the code for each instantiation. Also I imagine that common-to-all tests should probably be done inside the

Re: Instance-specific unittests

2012-02-13 Thread Steven Schveighoffer
On Mon, 13 Feb 2012 18:12:15 -0500, H. S. Teoh hst...@quickfur.ath.cx wrote: I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at runtime before main() is called. They are very

Re: Instance-specific unittests

2012-02-13 Thread H. S. Teoh
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.