I’ve been pretty big on unit tests for a long time now, but for some reason (maybe I’m mildly retarded?), I’ve always used my own homespun CHECK macro to code unit tests, something like this:
#define CHECK( condition ) do { if ( !(condition) ) { exit(1); } } while(0)
I switched some tests over to UnitTest++ last weekend, and I can’t believe I left it so long, UnitTest++ is great!
What can I say, it took about a minute to integrate it into my project, then a few hours to convert my tests over – everything worked first time. It’s simple and clean, and I can easily run my tests as part of my build process so I *have* to fix the tests whenever they fail before my game runs.
I’m not even using any of it’s more advanced features. Just using CHECK, SUITE and TEST, and the occasional TEST_FIXTURE when needed.
So if you have your own shitty ASSERT or CHECK macro based tests, switch over now! And if you aren’t using unit tests in your code, what the hell are you fucking insane?!! I hope you enjoy debugging because ya gonna be doing a lot of it!
Do yourself a favor and check it out if you haven’t already:
{ 6 comments… read them below or add one }
Glad you liked it so much! I do, but I’m biased
yeah jim has been poking me to switch over to UnitTest++ – he was right!
Haha thanks for the kind words Glenn!
!!!!
I was looking into using the unit test framework presented in the TICPP book, but UnitTest++ has just stolen all the cookies.
So awesome.
The next step of the unit tester is often mock objects…
http://code.google.com/p/googlemock/
Unfortunately Google Mock requires Google Test (though Google Test looks quite similar to UnitTest++ I have to say).
http://code.google.com/p/amop/
A good mock libaray which can be used with UnitTest++