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 : $RCSfile$ |
9 | // |
10 | // Version : $Revision: 74640 $ |
11 | // |
12 | // Description : defines global_fixture |
13 | // *************************************************************************** |
14 | |
15 | #ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER |
16 | #define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER |
17 | |
18 | // Boost.Test |
19 | #include <boost/test/detail/config.hpp> |
20 | #include <boost/test/detail/global_typedef.hpp> |
21 | |
22 | #include <boost/test/tree/observer.hpp> |
23 | |
24 | #include <boost/test/detail/suppress_warnings.hpp> |
25 | |
26 | |
27 | //____________________________________________________________________________// |
28 | |
29 | namespace boost { |
30 | namespace unit_test { |
31 | |
32 | // ************************************************************************** // |
33 | // ************** global_fixture ************** // |
34 | // ************************************************************************** // |
35 | |
36 | class BOOST_TEST_DECL global_fixture : public test_observer { |
37 | public: |
38 | // Constructor |
39 | global_fixture(); |
40 | }; |
41 | |
42 | //____________________________________________________________________________// |
43 | |
44 | namespace ut_detail { |
45 | |
46 | template<typename F> |
47 | struct global_fixture_impl : public global_fixture { |
48 | // Constructor |
49 | global_fixture_impl() : m_fixture( 0 ) {} |
50 | |
51 | // test observer interface |
52 | virtual void test_start( counter_t ) { m_fixture = new F; } |
53 | virtual void test_finish() { delete m_fixture; m_fixture = 0; } |
54 | virtual void test_aborted() { delete m_fixture; m_fixture = 0; } |
55 | |
56 | private: |
57 | // Data members |
58 | F* m_fixture; |
59 | }; |
60 | |
61 | } // namespace ut_detail |
62 | } // namespace unit_test |
63 | } // namespace boost |
64 | |
65 | #include <boost/test/detail/enable_warnings.hpp> |
66 | |
67 | #endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER |
68 | |
69 | |