3 // $Id: cpptest-textoutput.h,v 1.3 2005/06/08 08:08:06 nilu Exp $
5 // CppTest - A C++ Unit Testing Framework
6 // Copyright (c) 2003 Niklas Lundell
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the
22 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 // Boston, MA 02111-1307, USA.
29 #ifndef CPPTEST_TEXTOUTPUT_H
30 #define CPPTEST_TEXTOUTPUT_H
35 #include "cpptest-source.h"
36 #include "cpptest-output.h"
40 /// \brief Text output handler that outputs to the a stream.
42 /// %Test suite output handler that writes its information as text to a
43 /// a stream. It it possible to select between two different operational
44 /// modes that controls the detail level, see Mode.
46 class TextOutput
: public Output
53 /// Terse output mode, which only shows the number of correct tests.
57 /// Verbose output mode, which also shows extended assert
58 /// information for each test that failed.
63 TextOutput(Mode mode
, std::ostream
& stream
= std::cout
);
65 virtual void finished(int tests
, const Time
& time
);
66 virtual void suite_start(int tests
, const std::string
& name
);
67 virtual void suite_end(int tests
, const std::string
& name
,
69 virtual void test_end(const std::string
& name
, bool ok
,
71 virtual void assertment(const Source
& s
);
74 typedef std::list
<Source
> ErrorList
;
77 std::ostream
& _stream
;
78 ErrorList _suite_error_list
;
79 std::string _suite_name
;
82 int _suite_total_tests
;
88 #endif // #ifndef CPPTEST_TEXTOUTPUT_H