3 // $Id: cpptest-output.h,v 1.7 2008/07/15 21:20:26 hartwork 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_OUTPUT_H
30 #define CPPTEST_OUTPUT_H
35 # define CPPTEST_UNUSED(x)
37 # define CPPTEST_UNUSED(x) (void)x
45 /// \brief %Test suite output handler.
47 /// Abstract base class for all suite output handlers. Derive from this
48 /// class to create real output handlers that creates arbitrary complex
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.
62 /// Called when testing is started.
64 /// \param tests Total number of tests in all suites.
66 virtual void initialize(int tests
)
68 CPPTEST_UNUSED(tests
);
71 /// Called when testing is finished.
73 /// \param tests Total number of tests in all suites.
74 /// \param time Total elapsed time for all tests.
76 virtual void finished(int tests
, const Time
& time
)
78 CPPTEST_UNUSED(tests
);
82 /// Called when a suite is entered.
84 /// \param tests Number of tests in this suite.
85 /// \param name Name of the suite.
87 virtual void suite_start(int tests
, const std::string
& name
)
89 CPPTEST_UNUSED(tests
);
93 /// Called when a suite is finished.
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.
99 virtual void suite_end(int tests
, const std::string
& name
,
102 CPPTEST_UNUSED(tests
);
103 CPPTEST_UNUSED(name
);
104 CPPTEST_UNUSED(time
);
107 /// Called when a tests is executed.
109 /// \param name Name of the test function.
111 virtual void test_start(const std::string
& name
)
113 CPPTEST_UNUSED(name
);
116 /// Called when a test if finished, regardless if an assertment was
119 /// \param name Name of the test function.
120 /// \param ok True if the test was successful; false otherwise.
121 /// \param time Execution time.
123 virtual void test_end(const std::string
& name
, bool ok
,
126 CPPTEST_UNUSED(name
);
128 CPPTEST_UNUSED(time
);
131 /// Called when an assertment is issued.
133 /// \param s Assert point information.
135 virtual void assertment(const Source
& s
)
141 /// Empty constructor.
146 Output(const Output
&);
147 Output
& operator=(const Output
&);
152 #endif // #ifndef CPPTEST_OUTPUT_H