results_reporter.hpp 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // (C) Copyright Gennadiy Rozental 2001-2008.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // File : $RCSfile$
  8. //
  9. // Version : $Revision: 49312 $
  10. //
  11. // Description : defines class unit_test_result that is responsible for
  12. // gathering test results and presenting this information to end-user
  13. // ***************************************************************************
  14. #ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
  15. #define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
  16. // Boost.Test
  17. #include <boost/test/detail/global_typedef.hpp>
  18. #include <boost/test/detail/fwd_decl.hpp>
  19. // STL
  20. #include <iosfwd> // for std::ostream&
  21. #include <boost/test/detail/suppress_warnings.hpp>
  22. //____________________________________________________________________________//
  23. namespace boost {
  24. namespace unit_test {
  25. namespace results_reporter {
  26. // ************************************************************************** //
  27. // ************** formatter interface ************** //
  28. // ************************************************************************** //
  29. class BOOST_TEST_DECL format {
  30. public:
  31. // Destructor
  32. virtual ~format() {}
  33. virtual void results_report_start( std::ostream& ostr ) = 0;
  34. virtual void results_report_finish( std::ostream& ostr ) = 0;
  35. virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0;
  36. virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0;
  37. virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0;
  38. };
  39. // ************************************************************************** //
  40. // ************** report configuration ************** //
  41. // ************************************************************************** //
  42. BOOST_TEST_DECL void set_level( report_level );
  43. BOOST_TEST_DECL void set_stream( std::ostream& );
  44. BOOST_TEST_DECL void set_format( output_format );
  45. BOOST_TEST_DECL void set_format( results_reporter::format* );
  46. BOOST_TEST_DECL std::ostream& get_stream();
  47. // ************************************************************************** //
  48. // ************** report initiation ************** //
  49. // ************************************************************************** //
  50. BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID );
  51. inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID )
  52. { make_report( CONFIRMATION_REPORT, id ); }
  53. inline void short_report( test_unit_id id = INV_TEST_UNIT_ID )
  54. { make_report( SHORT_REPORT, id ); }
  55. inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID )
  56. { make_report( DETAILED_REPORT, id ); }
  57. } // namespace results_reporter
  58. } // namespace unit_test
  59. } // namespace boost
  60. //____________________________________________________________________________//
  61. #include <boost/test/detail/enable_warnings.hpp>
  62. #endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER