Вопрос

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.)

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top