diff options
Diffstat (limited to 'boost/test/results_reporter.hpp')
-rw-r--r-- | boost/test/results_reporter.hpp | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/boost/test/results_reporter.hpp b/boost/test/results_reporter.hpp index 862c622a68..4c8627e458 100644 --- a/boost/test/results_reporter.hpp +++ b/boost/test/results_reporter.hpp @@ -1,16 +1,15 @@ -// (C) Copyright Gennadiy Rozental 2001-2008. +// (C) Copyright Gennadiy Rozental 2001-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines class unit_test_result that is responsible for -// gathering test results and presenting this information to end-user +/// @file +/// @brief defines testing result reporter interfaces +/// +/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of +/// free standing function implemented in namespace result_reporter // *************************************************************************** #ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER @@ -28,13 +27,17 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { +/// Namespace for results reporter interfaces namespace results_reporter { // ************************************************************************** // -// ************** formatter interface ************** // +/// @brief Results report formatter interface +/// +/// This is abstract interface for the report formatter used by results reporter routines. +/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function. +/// This is usually done during test module initialization // ************************************************************************** // class BOOST_TEST_DECL format { @@ -52,22 +55,57 @@ public: }; // ************************************************************************** // -// ************** report configuration ************** // +/// @name report configuration // ************************************************************************** // -BOOST_TEST_DECL void set_level( report_level ); +/// Sets reporting level + +/// There are only four possible levels for results report: +/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation +/// message about test module pass/fail status +/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed +/// assertions and test units. +/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for +/// passed/failed assertions and uncaught exceptions +/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules +/// running as part of some kind of continues integration framework +/// @param[in] l report level +BOOST_TEST_DECL void set_level( report_level l ); + +/// Sets output stream for results reporting + +/// By default std::cerr is used. Use this function to set a different stream. The framework +/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope. BOOST_TEST_DECL void set_stream( std::ostream& ); -BOOST_TEST_DECL void set_format( output_format ); -BOOST_TEST_DECL void set_format( results_reporter::format* ); +/// Sets one of the predefined formats + +/// The framework implements two results report formats: +/// - plain human readable format (boost::unit_test::OF_CLF) +/// - XML format (boost::unit_test::OF_XML) +/// @param[in] of one of the presefined enumeration values for output formats +BOOST_TEST_DECL void set_format( output_format of ); + +/// Sets custom report formatter + +/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to +/// a heap allocated object +/// @param[in] f pointer to heap allocated instance of custom report formatter class +BOOST_TEST_DECL void set_format( results_reporter::format* f ); + +/// @brief Access to configured results reporter stream +/// +/// Use this stream to report additional information abut test module execution BOOST_TEST_DECL std::ostream& get_stream(); +/// @} + // ************************************************************************** // // ************** report initiation ************** // // ************************************************************************** // BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID ); -inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) +inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( CONFIRMATION_REPORT, id ); } inline void short_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( SHORT_REPORT, id ); } @@ -75,13 +113,9 @@ inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( DETAILED_REPORT, id ); } } // namespace results_reporter - } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> #endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER |