progress_monitor.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // (C) Copyright Gennadiy Rozental 2001.
  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
  8. /// @brief defines simple text based progress monitor
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
  11. #define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER
  12. // Boost.Test
  13. #include <boost/test/tree/observer.hpp>
  14. #include <boost/test/utils/trivial_singleton.hpp>
  15. // STL
  16. #include <iosfwd> // for std::ostream&
  17. #include <boost/test/detail/suppress_warnings.hpp>
  18. //____________________________________________________________________________//
  19. namespace boost {
  20. namespace unit_test {
  21. // ************************************************************************** //
  22. // ************** progress_monitor ************** //
  23. // ************************************************************************** //
  24. /// This class implements test observer interface and updates test progress as test units finish or get aborted
  25. class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton<progress_monitor_t> {
  26. public:
  27. /// @name Test observer interface
  28. /// @{
  29. virtual void test_start( counter_t test_cases_amount );
  30. virtual void test_aborted();
  31. virtual void test_unit_finish( test_unit const&, unsigned long );
  32. virtual void test_unit_skipped( test_unit const&, const_string );
  33. virtual int priority() { return 3; }
  34. /// @}
  35. /// @name Configuration
  36. /// @{
  37. void set_stream( std::ostream& );
  38. /// @}
  39. private:
  40. BOOST_TEST_SINGLETON_CONS( progress_monitor_t )
  41. }; // progress_monitor_t
  42. BOOST_TEST_SINGLETON_INST( progress_monitor )
  43. } // namespace unit_test
  44. } // namespace boost
  45. //____________________________________________________________________________//
  46. #include <boost/test/detail/enable_warnings.hpp>
  47. #endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER