c++ - Printf-Style Assertions using CPPUnit -


does cppunit have functionality allow me printf-style assertions? example:

cppunit_assert("actual size: %d", p->getsize(), p->getsize() == 0); 

i know not valid cppunit_assert - using example.

i found cppunit_assert_message(message,condition) takes string , condition evaluate no luck getting value assert.

you should able this:

#define cppunit_assert_stream(msg, condition) \     { \         std::ostringstream oss; \         cppunit_assert_message(\             static_cast<std::ostringstream &>(oss << msg).str(), \             condition); \     } while (0)  cppunit_assert_stream("actual size: " << p->getsize(), p->getsize() == 0); 

the above macro can combined boost.format:

cppunit_assert_stream(boost::format("actual size: %d") % p->getsize(),                       p->getsize() == 0); 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -