Frage

Is there a way to get the current error count of the current test case in Boost UTF?

I'd like to execute code in the case that at least one check in my test case failed. Something like:

 if (BOOST_ERROR_COUNT > 0) { ... }

(This macro does not exist.)

War es hilfreich?

Lösung

You can access information about the current test case via the boost::unit_test::results_collector

e.g.

using boost::unit_test::results_collector;
using boost::unit_test::framework::current_test_case;
using boost::unit_test::test_case;
using boost::unit_test::test_results;

const test_results& theResults = results_collector.results( current_test_case().p_id );

This gets you a boost::unit_test::test_results which contains all of the information you are after.

See Also boost/test/results_collector.hpp

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top