Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_CppTest / SRC / core / cpptest-textoutput.h
1 // ---
2 //
3 // $Id: cpptest-textoutput.h,v 1.3 2005/06/08 08:08:06 nilu Exp $
4 //
5 // CppTest - A C++ Unit Testing Framework
6 // Copyright (c) 2003 Niklas Lundell
7 //
8 // ---
9 //
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.
14 //
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.
19 //
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.
24 //
25 // ---
26
27 /** \file */
28
29 #ifndef CPPTEST_TEXTOUTPUT_H
30 #define CPPTEST_TEXTOUTPUT_H
31
32 #include <iostream>
33 #include <list>
34
35 #include "cpptest-source.h"
36 #include "cpptest-output.h"
37
38 namespace Test
39 {
40 /// \brief Text output handler that outputs to the a stream.
41 ///
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.
45 ///
46 class TextOutput : public Output
47 {
48 public:
49 /// Output mode.
50 ///
51 enum Mode
52 {
53 /// Terse output mode, which only shows the number of correct tests.
54 ///
55 Terse,
56
57 /// Verbose output mode, which also shows extended assert
58 /// information for each test that failed.
59 ///
60 Verbose
61 };
62
63 TextOutput(Mode mode, std::ostream& stream = std::cout);
64
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,
68 const Time& time);
69 virtual void test_end(const std::string& name, bool ok,
70 const Time& time);
71 virtual void assertment(const Source& s);
72
73 private:
74 typedef std::list<Source> ErrorList;
75
76 Mode _mode;
77 std::ostream& _stream;
78 ErrorList _suite_error_list;
79 std::string _suite_name;
80 int _suite_errors;
81 int _suite_tests;
82 int _suite_total_tests;
83 int _total_errors;
84 };
85
86 } // namespace Test
87
88 #endif // #ifndef CPPTEST_TEXTOUTPUT_H