
Richard wrote: [SNIP]
If it fails, it tells me this:
basics.cpp(61): error in "test_case": check cont.erase(key) == 1u failed [0 != 1]
If you use BOOST_CHECK_MESSAGE(predicate, message), you can create a custom failure message that contains additional context:
#define BOOST_TEST_MODULE example #include
#include <cmath>
BOOST_AUTO_TEST_CASE( test ) { double res = std::sin( 45. );
BOOST_WARN_MESSAGE( res > 1, "sin(45){" << res << "} is <= 1. Hmm.. Strange. " ); }
Thanks! I was doing that earlier, but I was hoping there is a "better" solution. With this, I have to do all the things "by hand", so for example the spelling out of the two sides of an EQUAL check. :( It seems that I have to "duplicate" all existing macros and create something like a BOOST_CHECK_..._WITH(...) series. Eg.: BOOST_CHECK_EQUAL_WITH(lhs,rhs,v1,v2) used as: BOOST_CHECK_EQUAL_WITH(a[i],b[j],i,j) output: tests.cpp(99): error in "test_case": check a[i] == b[j] [with i==1, j==42] failed [0 != 1] BR, Attila aka WW