Boost C++ Libraries: Ticket #11911: BOOST_TEST macro's argument must be put between brackets https://svn.boost.org/trac10/ticket/11911 <p> This program doesn't work </p> <pre class="wiki">#define BOOST_TEST_MODULE test #include &lt;boost/test/included/unit_test.hpp&gt; struct B {}; struct A { bool operator ==(const B &amp;b) { return true; } }; BOOST_AUTO_TEST_CASE(test_case) { A a; B b; BOOST_TEST(a == b); // BOOST_TEST((a == b)); // this version works } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11911 Trac 1.4.3 Gennadiy Rozental Thu, 14 Jan 2016 16:17:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11911#comment:1 https://svn.boost.org/trac10/ticket/11911#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <ol><li>Don't name your test case test_case </li><li>make operator== const </li><li>Add BOOST_TEST_DONT_PRINT_LOG_VALUE(A) BOOST_TEST_DONT_PRINT_LOG_VALUE(B) </li></ol><p> or implement operator&lt;&lt; for A and B </p> <p> And this example works fine for me with single brackets. </p> Ticket anonymous Thu, 14 Jan 2016 17:07:58 GMT <link>https://svn.boost.org/trac10/ticket/11911#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11911#comment:2</guid> <description> <p> About const, I forgot it in this short example and the name of the test case was randomly picked. </p> <p> But, about the different behaviour when there are brackets around the condition and when not, it feels inconsistent to me. Also, I got some very cryptic error messages from the compiler referring to boost's files. I'm ok with boost trying to print the object it is testing if this is a generally expected behaviour in unit test frameworks. However a static_assert with a comprehensible error message in case this can't be done should be useful and save much debugging time. </p> <p> Thank you for the help. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gennadiy Rozental</dc:creator> <pubDate>Thu, 14 Jan 2016 19:20:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11911#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11911#comment:3</guid> <description> <p> Try branch assert-printability </p> </description> <category>Ticket</category> </item> </channel> </rss>