Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_CppTest / INC / cpptest-collectoroutput.h
1 // ---
2 //
3 // $Id: cpptest-collectoroutput.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_COLLECTOROUTPUT_H
30 #define CPPTEST_COLLECTOROUTPUT_H
31
32 #include <list>
33 #include <string>
34 #include <vector>
35
36 #include "cpptest-output.h"
37 #include "cpptest-source.h"
38 #include "cpptest-time.h"
39
40 namespace Test
41 {
42 /// \brief Collector output.
43 ///
44 /// Base class for output handlers that need to report status when all
45 /// tests have executed.
46 ///
47 class CollectorOutput : public Output
48 {
49 public:
50 virtual void finished(int tests, const Time& time);
51 virtual void suite_start(int tests, const std::string& name);
52 virtual void suite_end(int tests, const std::string& name,
53 const Time& time);
54 virtual void test_start(const std::string& name);
55 virtual void test_end(const std::string& name, bool ok,
56 const Time& time);
57 virtual void assertment(const Source& s);
58
59 protected:
60 struct OutputSuiteInfo;
61 struct OutputTestInfo;
62 struct OutputErrorTestInfo;
63
64 typedef std::list<Source> Sources;
65
66 struct TestInfo
67 {
68 std::string _name;
69 Time _time;
70
71 bool _success : 1;
72 Sources _sources;
73
74 explicit TestInfo(const std::string name);
75 };
76
77 typedef std::vector<TestInfo> Tests;
78
79 struct SuiteInfo
80 {
81 std::string _name;
82 int _errors;
83 Tests _tests;
84 Time _time;
85
86 SuiteInfo(const std::string& name, int tests);
87 };
88
89 typedef std::list<SuiteInfo> Suites;
90
91 Suites _suites;
92 int _total_errors;
93 int _total_tests;
94 Time _total_time;
95
96 CollectorOutput();
97
98 private:
99 SuiteInfo* _cur_suite;
100 TestInfo* _cur_test;
101 };
102
103 } // namespace Test
104
105 #endif // #ifndef CPPTEST_COLLECTOROUTPUT_H
106