source: NonGTP/Boost/boost/test/unit_test_log_formatter.hpp @ 857

Revision 857, 4.9 KB checked in by igarcia, 18 years ago (diff)
Line 
1//  (C) Copyright Gennadiy Rozental 2003-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: unit_test_log_formatter.hpp,v $
9//
10//  Version     : $Revision: 1.13 $
11//
12//  Description :
13// ***************************************************************************
14
15#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
16#define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
17
18// Boost.Test
19#include <boost/test/detail/global_typedef.hpp>
20#include <boost/test/detail/log_level.hpp>
21#include <boost/test/detail/fwd_decl.hpp>
22
23// STL
24#include <iosfwd>
25#include <string> // for std::string
26
27#include <boost/test/detail/suppress_warnings.hpp>
28
29//____________________________________________________________________________//
30
31namespace boost {
32
33namespace unit_test {
34
35// ************************************************************************** //
36// **************                log_entry_data                ************** //
37// ************************************************************************** //
38
39struct log_entry_data {
40    std::string     m_file;
41    std::size_t     m_line;
42    log_level       m_level;
43
44    void clear()
45    {
46        m_file    = std::string();
47        m_line    = 0;
48        m_level   = log_nothing;
49    }
50};
51
52// ************************************************************************** //
53// **************                checkpoint_data               ************** //
54// ************************************************************************** //
55
56struct log_checkpoint_data
57{
58    std::string     m_file;
59    std::size_t     m_line;
60    std::string     m_message;
61
62    void clear()
63    {
64        m_file    = std::string();
65        m_line    = 0;
66        m_message = std::string();
67    }
68};
69
70// ************************************************************************** //
71// **************            unit_test_log_formatter           ************** //
72// ************************************************************************** //
73
74class unit_test_log_formatter {
75public:
76    enum log_entry_types { BOOST_UTL_ET_INFO,
77                           BOOST_UTL_ET_MESSAGE,
78                           BOOST_UTL_ET_WARNING,
79                           BOOST_UTL_ET_ERROR,
80                           BOOST_UTL_ET_FATAL_ERROR };
81
82    // Destructor
83    virtual             ~unit_test_log_formatter() {}
84
85    // Formatter interface
86    virtual void        log_start( std::ostream&, counter_t test_cases_amount ) = 0;
87    virtual void        log_finish( std::ostream& ) = 0;
88    virtual void        log_build_info( std::ostream& ) = 0;
89
90    virtual void        test_unit_start( std::ostream&, test_unit const& tu ) = 0;
91    virtual void        test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) = 0;
92    virtual void        test_unit_skipped( std::ostream&, test_unit const& ) = 0;
93
94    virtual void        log_exception( std::ostream&, log_checkpoint_data const&, const_string explanation ) = 0;
95
96    virtual void        log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) = 0;
97    virtual void        log_entry_value( std::ostream&, const_string value ) = 0;
98    virtual void        log_entry_finish( std::ostream& ) = 0;
99};
100
101} // namespace unit_test
102
103} // namespace boost
104
105//____________________________________________________________________________//
106
107#include <boost/test/detail/enable_warnings.hpp>
108
109// ***************************************************************************
110//  Revision History :
111// 
112//  $Log: unit_test_log_formatter.hpp,v $
113//  Revision 1.13  2005/02/20 08:27:06  rogeeff
114//  This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
115//
116//  Revision 1.12  2005/02/01 08:59:28  rogeeff
117//  supplied_log_formatters split
118//  change formatters interface to simplify result interface
119//
120//  Revision 1.11  2005/02/01 06:40:06  rogeeff
121//  copyright update
122//  old log entries removed
123//  minor stilistic changes
124//  depricated tools removed
125//
126//  Revision 1.10  2005/01/30 03:23:58  rogeeff
127//  counter type renamed
128//  log interface slightly shortened
129//
130//  Revision 1.9  2005/01/21 07:30:24  rogeeff
131//  to log testing time log formatter interfaces changed
132//
133//  Revision 1.8  2005/01/18 08:26:12  rogeeff
134//  unit_test_log rework:
135//     eliminated need for ::instance()
136//     eliminated need for << end and ...END macro
137//     straitend interface between log and formatters
138//     change compiler like formatter name
139//     minimized unit_test_log interface and reworked to use explicit calls
140//
141// ***************************************************************************
142
143#endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
144
Note: See TracBrowser for help on using the repository browser.