[Cppunit-devel] Please move if() out of functions into macros
Brought to you by:
blep
From: <rm...@ma...> - 2002-11-14 15:58:51
|
I was experiencing a 10x slow down running my test suite using cppunit. I realized that the CPPUNIT_ASSERT and CPPUNIT_ASSERT_EQUAL cause the construction of multiple std::strings even if the condition is true. This seems silly to me. I wanted to suggest that the CPPUNIT_ASSERT macro directly contain the conditional. That way in the (hopefully) likely case where the assertion is true, no unnecessary std::strings are constructed. I've already modified my test suite to use if (...) CPPUNIT_FAIL(...), but I think this should be a useful and harmless speed increase. I understand that enough logic goes into CPPUNIT_ASSERT_DOUBLES_EQUAL that the conditional should stay in the function, and I can live with that. Thanks, Ryan Mack |