Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_CppTest / INC / cpptest-output.h
1 // ---
2 //
3 // $Id: cpptest-output.h,v 1.7 2008/07/15 21:20:26 hartwork 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_OUTPUT_H
30 #define CPPTEST_OUTPUT_H
31
32 #include <string>
33
34 #ifdef _MSC_VER
35 # define CPPTEST_UNUSED(x)
36 #else
37 # define CPPTEST_UNUSED(x) (void)x
38 #endif
39
40 namespace Test
41 {
42 class Source;
43 class Time;
44
45 /// \brief %Test suite output handler.
46 ///
47 /// Abstract base class for all suite output handlers. Derive from this
48 /// class to create real output handlers that creates arbitrary complex
49 /// output handlers.
50 ///
51 /// All parts of testing is reported (test start/stop, suite start/stop,
52 /// individual test start/stop, and assertments), thus giving maximum
53 /// flexibility for derived classes.
54 ///
55 class Output
56 {
57 public:
58 /// Empty destructor.
59 ///
60 virtual ~Output() {}
61
62 /// Called when testing is started.
63 ///
64 /// \param tests Total number of tests in all suites.
65 ///
66 virtual void initialize(int tests)
67 {
68 CPPTEST_UNUSED(tests);
69 }
70
71 /// Called when testing is finished.
72 ///
73 /// \param tests Total number of tests in all suites.
74 /// \param time Total elapsed time for all tests.
75 ///
76 virtual void finished(int tests, const Time& time)
77 {
78 CPPTEST_UNUSED(tests);
79 CPPTEST_UNUSED(time);
80 }
81
82 /// Called when a suite is entered.
83 ///
84 /// \param tests Number of tests in this suite.
85 /// \param name Name of the suite.
86 ///
87 virtual void suite_start(int tests, const std::string& name)
88 {
89 CPPTEST_UNUSED(tests);
90 CPPTEST_UNUSED(name);
91 }
92
93 /// Called when a suite is finished.
94 ///
95 /// \param tests Number of tests in this suite.
96 /// \param name Name of the suite.
97 /// \param time Total elapsed time for all tests in this suite.
98 ///
99 virtual void suite_end(int tests, const std::string& name,
100 const Time& time)
101 {
102 CPPTEST_UNUSED(tests);
103 CPPTEST_UNUSED(name);
104 CPPTEST_UNUSED(time);
105 }
106
107 /// Called when a tests is executed.
108 ///
109 /// \param name Name of the test function.
110 ///
111 virtual void test_start(const std::string& name)
112 {
113 CPPTEST_UNUSED(name);
114 }
115
116 /// Called when a test if finished, regardless if an assertment was
117 /// issued.
118 ///
119 /// \param name Name of the test function.
120 /// \param ok True if the test was successful; false otherwise.
121 /// \param time Execution time.
122 ///
123 virtual void test_end(const std::string& name, bool ok,
124 const Time& time)
125 {
126 CPPTEST_UNUSED(name);
127 CPPTEST_UNUSED(ok);
128 CPPTEST_UNUSED(time);
129 }
130
131 /// Called when an assertment is issued.
132 ///
133 /// \param s Assert point information.
134 ///
135 virtual void assertment(const Source& s)
136 {
137 CPPTEST_UNUSED(s);
138 }
139
140 protected:
141 /// Empty constructor.
142 ///
143 Output() {}
144
145 private:
146 Output(const Output&);
147 Output& operator=(const Output&);
148 };
149
150 } // namespace Test
151
152 #endif // #ifndef CPPTEST_OUTPUT_H