| 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 | |
| 6 | // See http://www.boost.org/libs/test for the library home page. |
| 7 | // |
| 8 | /// @file |
| 9 | /// @brief defines simple text based progress monitor |
| 10 | // *************************************************************************** |
| 11 | |
| 12 | #ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER |
| 13 | #define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER |
| 14 | |
| 15 | // Boost.Test |
| 16 | #include <boost/test/tree/observer.hpp> |
| 17 | |
| 18 | // STL |
| 19 | #include <iosfwd> // for std::ostream& |
| 20 | |
| 21 | #include <boost/test/detail/suppress_warnings.hpp> |
| 22 | |
| 23 | //____________________________________________________________________________// |
| 24 | |
| 25 | namespace boost { |
| 26 | namespace unit_test { |
| 27 | |
| 28 | // ************************************************************************** // |
| 29 | // ************** progress_monitor ************** // |
| 30 | // ************************************************************************** // |
| 31 | |
| 32 | /// This class implements test observer interface and updates test progress as test units finish or get aborted |
| 33 | class BOOST_TEST_DECL progress_monitor_t : public test_observer { |
| 34 | public: |
| 35 | /// @name Test observer interface |
| 36 | /// @{ |
| 37 | void test_start( counter_t test_cases_amount, test_unit_id ) BOOST_OVERRIDE; |
| 38 | void test_aborted() BOOST_OVERRIDE; |
| 39 | |
| 40 | void test_unit_finish( test_unit const&, unsigned long ) BOOST_OVERRIDE; |
| 41 | void test_unit_skipped( test_unit const&, const_string ) BOOST_OVERRIDE; |
| 42 | |
| 43 | int priority() BOOST_OVERRIDE { return 4; } |
| 44 | /// @} |
| 45 | |
| 46 | /// @name Configuration |
| 47 | /// @{ |
| 48 | void set_stream( std::ostream& ); |
| 49 | /// @} |
| 50 | |
| 51 | /// Singleton pattern |
| 52 | BOOST_TEST_SINGLETON_CONS( progress_monitor_t ) |
| 53 | }; // progress_monitor_t |
| 54 | |
| 55 | BOOST_TEST_SINGLETON_INST( progress_monitor ) |
| 56 | |
| 57 | } // namespace unit_test |
| 58 | } // namespace boost |
| 59 | |
| 60 | //____________________________________________________________________________// |
| 61 | |
| 62 | #include <boost/test/detail/enable_warnings.hpp> |
| 63 | |
| 64 | #endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER |
| 65 | |
| 66 |
