#11911 closed Bugs (worksforme)
BOOST_TEST macro's argument must be put between brackets
Reported by: | anonymous | Owned by: | Gennadiy Rozental |
---|---|---|---|
Milestone: | To Be Determined | Component: | test |
Version: | Boost 1.60.0 | Severity: | Problem |
Keywords: | Cc: |
Description
This program doesn't work
#define BOOST_TEST_MODULE test #include <boost/test/included/unit_test.hpp> struct B {}; struct A { bool operator ==(const B &b) { return true; } }; BOOST_AUTO_TEST_CASE(test_case) { A a; B b; BOOST_TEST(a == b); // BOOST_TEST((a == b)); // this version works }
Change History (3)
comment:1 by , 7 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 7 years ago
About const, I forgot it in this short example and the name of the test case was randomly picked.
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.
Thank you for the help.
or implement operator<< for A and B
And this example works fine for me with single brackets.