Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2007-10-30 14:52:30

John Maddock <john <at>> writes:

> If I'm using
> #include <boost/test/included/test_exec_monitor.hpp>
> Is there a way to check if the last BOOST_CHECK_CLOSE passed or failed?

You can do this by accessing number of failures in results collector:

results_collector.results( framework::current_test_case().p_id );

Alternatively you can use check_is_close predicate directly, print whatever
you need if it failes (including mismatched values) and report it to the
framework using BOOST_ERROR of BOOST_CHECK call.

Finally you can implement you own predicate on top of check_is_close, that
returns class predicate_value. This will allow you to report arbitrary message
in case of failure or success, but should print failed argument values itself.


P.S. Yet another solution is to print what you need unconditionally. But do it
on "message" level (using BOOST_TEST_MESSAGE). This way you can print what you
need if you want, by setting proper log level

Boost list run by bdawes at, gregod at, cpdaniel at, john at