Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/test/results_collector.hpp @ 46

Last change on this file since 46 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.8 KB
Line 
1//  (C) Copyright Gennadiy Rozental 2001-2005.
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: results_collector.hpp,v $
9//
10//  Version     : $Revision: 1.2 $
11//
12//  Description : defines class unit_test_result that is responsible for
13//  gathering test results and presenting this information to end-user
14// ***************************************************************************
15
16#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
17#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
18
19// Boost.Test
20#include <boost/test/test_observer.hpp>
21
22#include <boost/test/detail/global_typedef.hpp>
23#include <boost/test/detail/fwd_decl.hpp>
24
25#include <boost/test/utils/trivial_singleton.hpp>
26#include <boost/test/utils/class_properties.hpp>
27
28#include <boost/test/detail/suppress_warnings.hpp>
29
30//____________________________________________________________________________//
31
32namespace boost {
33
34namespace unit_test {
35
36// ************************************************************************** //
37// **************      first failed assertion debugger hook    ************** //
38// ************************************************************************** //
39
40namespace {
41inline void first_failed_assertion() {}
42}
43
44// ************************************************************************** //
45// **************                 test_results                 ************** //
46// ************************************************************************** //
47
48class BOOST_TEST_DECL test_results {
49public:
50    test_results();
51
52    typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t)(test_results)(results_collect_helper) ) counter_prop;
53    typedef BOOST_READONLY_PROPERTY( bool,      (results_collector_t)(test_results)(results_collect_helper) ) bool_prop;
54
55    counter_prop    p_assertions_passed;
56    counter_prop    p_assertions_failed;
57    counter_prop    p_expected_failures;
58    counter_prop    p_test_cases_passed;
59    counter_prop    p_test_cases_failed;
60    counter_prop    p_test_cases_skipped;
61    counter_prop    p_test_cases_aborted;
62    bool_prop       p_aborted;
63    bool_prop       p_skipped;
64
65    // "conclusion" methods
66    bool            passed() const;
67    int             result_code() const;
68
69    // collection helper
70    void            operator+=( test_results const& );
71
72    void            clear();
73};
74
75// ************************************************************************** //
76// **************               results_collector              ************** //
77// ************************************************************************** //
78
79class BOOST_TEST_DECL results_collector_t : public test_observer, public singleton<results_collector_t> {
80public:
81    // test_observer interface implementation
82    void                test_start( counter_t test_cases_amount );
83    void                test_finish();
84    void                test_aborted();
85
86    void                test_unit_start( test_unit const& );
87    void                test_unit_finish( test_unit const&, unsigned long elapsed );
88    void                test_unit_skipped( test_unit const& );
89    void                test_unit_aborted( test_unit const& );
90
91    void                assertion_result( bool passed );
92    void                exception_caught( execution_exception const& );
93
94    // results access
95    test_results const& results( test_unit_id ) const;
96
97private:
98    BOOST_TEST_SINGLETON_CONS( results_collector_t );
99};
100
101BOOST_TEST_SINGLETON_INST( results_collector )
102
103} // namespace unit_test
104
105} // namespace boost
106
107//____________________________________________________________________________//
108
109#include <boost/test/detail/enable_warnings.hpp>
110
111// ***************************************************************************
112//  Revision History :
113// 
114//  $Log: results_collector.hpp,v $
115//  Revision 1.2  2005/12/14 05:12:24  rogeeff
116//  dll support introduced
117//  amount of aborted test cases in now computed. If test case is aborted - the whole
118//  test subtree is marked as aborted
119//
120//  Revision 1.1  2005/02/20 08:27:06  rogeeff
121//  This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
122//
123//  Revision 1.25  2005/02/01 08:59:29  rogeeff
124//  supplied_log_formatters split
125//  change formatters interface to simplify result interface
126//
127//  Revision 1.24  2005/02/01 06:40:06  rogeeff
128//  copyright update
129//  old log entries removed
130//  minor stilistic changes
131//  depricated tools removed
132//
133//  Revision 1.23  2005/01/30 03:23:06  rogeeff
134//  result_tracker class removed
135//  counter type renamed
136//
137// ***************************************************************************
138
139#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
140
Note: See TracBrowser for help on using the repository browser.