...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::unit_test::test_results — Collection of attributes constituting test unit results.
// In header: <boost/test/results_collector.hpp> class test_results { public: // construct/copy/destruct test_results(); // public member functions typedef BOOST_READONLY_PROPERTY(counter_t, (results_collector_t)(test_results)(results_collect_helper)); typedef BOOST_READONLY_PROPERTY(bool, (results_collector_t)(test_results)(results_collect_helper)); bool passed() const; bool skipped() const; bool aborted() const; int result_code() const; void operator+=(test_results const &); void clear(); // public data members counter_prop p_test_suites; // Number of test suites. counter_prop p_assertions_passed; // Number of successful assertions. counter_prop p_assertions_failed; // Number of failing assertions. counter_prop p_warnings_failed; // Number of warnings. counter_prop p_expected_failures; counter_prop p_test_cases_passed; // Number of successfull test cases. counter_prop p_test_cases_warned; // Number of warnings in test cases. counter_prop p_test_cases_failed; // Number of failing test cases. counter_prop p_test_cases_skipped; // Number of skipped test cases. counter_prop p_test_cases_aborted; // Number of aborted test cases. counter_prop p_test_cases_timed_out; // Number of timed out test cases. counter_prop p_test_suites_timed_out; // Number of timed out test suites. counter_prop p_duration_microseconds; // Duration of the test in microseconds. bool_prop p_aborted; // Indicates that the test unit execution has been aborted. bool_prop p_skipped; // Indicates that the test unit execution has been skipped. bool_prop p_timed_out; // Indicates that the test unit has timed out. };
This class is a collection of attributes describing a test result.
The attributes presented as public properties on an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question
test_results
public member functionstypedef BOOST_READONLY_PROPERTY(counter_t, (results_collector_t)(test_results)(results_collect_helper));Type representing counter like public property.
typedef BOOST_READONLY_PROPERTY(bool, (results_collector_t)(test_results)(results_collect_helper));Type representing boolean like public property.
bool passed() const;Returns true if test unit passed.
bool skipped() const;Returns true if test unit skipped.
For test suites, this indicates if the test suite itself has been marked as skipped, and not if the test suite contains any skipped test.
bool aborted() const;Returns true if the test unit was aborted (hard failure)
int result_code() const;Produces result code for the test unit execution.
This methhod return one of the result codes defined in boost/cstdlib.hpp
Returns: |
|
void operator+=(test_results const &);Combines the results of the current instance with another.
Only the counters are updated and the p_aborted
and p_skipped
are left unchanged.
void clear();Resets the current state of the result.