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 abstract interface for test observer |
10 | // *************************************************************************** |
11 | |
12 | #ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER |
13 | #define BOOST_TEST_TEST_OBSERVER_HPP_021005GER |
14 | |
15 | // Boost.Test |
16 | #include <boost/test/detail/fwd_decl.hpp> |
17 | #include <boost/test/detail/global_typedef.hpp> |
18 | #include <boost/test/detail/config.hpp> |
19 | |
20 | #include <boost/test/detail/suppress_warnings.hpp> |
21 | |
22 | //____________________________________________________________________________// |
23 | |
24 | namespace boost { |
25 | namespace unit_test { |
26 | |
27 | // ************************************************************************** // |
28 | // ************** test_observer ************** // |
29 | // ************************************************************************** // |
30 | |
31 | class BOOST_TEST_DECL test_observer { |
32 | public: |
33 | // test observer interface |
34 | virtual void test_start( counter_t /* test_cases_amount */ ) {} |
35 | virtual void test_finish() {} |
36 | virtual void test_aborted() {} |
37 | |
38 | virtual void test_unit_start( test_unit const& ) {} |
39 | virtual void test_unit_finish( test_unit const&, unsigned long /* elapsed */ ) {} |
40 | virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); } |
41 | virtual void test_unit_skipped( test_unit const& ) {} ///< backward compatibility |
42 | virtual void test_unit_aborted( test_unit const& ) {} |
43 | |
44 | virtual void assertion_result( unit_test::assertion_result ar ) |
45 | { |
46 | switch( ar ) { |
47 | case AR_PASSED: assertion_result( true ); break; |
48 | case AR_FAILED: assertion_result( false ); break; |
49 | case AR_TRIGGERED: break; |
50 | default: break; |
51 | } |
52 | } |
53 | virtual void exception_caught( execution_exception const& ) {} |
54 | |
55 | virtual int priority() { return 0; } |
56 | |
57 | protected: |
58 | // depracated now |
59 | virtual void assertion_result( bool /* passed */ ) {} |
60 | |
61 | BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {} |
62 | }; |
63 | |
64 | } // namespace unit_test |
65 | } // namespace boost |
66 | |
67 | #include <boost/test/detail/enable_warnings.hpp> |
68 | |
69 | #endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER |
70 | |
71 | |