--- /dev/null
+// ---\r
+//\r
+// $Id: cpptest-output.h,v 1.7 2008/07/15 21:20:26 hartwork Exp $\r
+//\r
+// CppTest - A C++ Unit Testing Framework\r
+// Copyright (c) 2003 Niklas Lundell\r
+//\r
+// ---\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the\r
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
+// Boston, MA 02111-1307, USA.\r
+//\r
+// ---\r
+\r
+/** \file */\r
+\r
+#ifndef CPPTEST_OUTPUT_H\r
+#define CPPTEST_OUTPUT_H\r
+\r
+#include <string>\r
+\r
+#ifdef _MSC_VER\r
+# define CPPTEST_UNUSED(x)\r
+#else\r
+# define CPPTEST_UNUSED(x) (void)x\r
+#endif\r
+\r
+namespace Test\r
+{\r
+ class Source;\r
+ class Time;\r
+ \r
+ /// \brief %Test suite output handler.\r
+ ///\r
+ /// Abstract base class for all suite output handlers. Derive from this\r
+ /// class to create real output handlers that creates arbitrary complex\r
+ /// output handlers.\r
+ ///\r
+ /// All parts of testing is reported (test start/stop, suite start/stop,\r
+ /// individual test start/stop, and assertments), thus giving maximum\r
+ /// flexibility for derived classes.\r
+ ///\r
+ class Output\r
+ {\r
+ public:\r
+ /// Empty destructor.\r
+ ///\r
+ virtual ~Output() {}\r
+ \r
+ /// Called when testing is started.\r
+ ///\r
+ /// \param tests Total number of tests in all suites.\r
+ ///\r
+ virtual void initialize(int tests)\r
+ {\r
+ CPPTEST_UNUSED(tests);\r
+ }\r
+ \r
+ /// Called when testing is finished.\r
+ ///\r
+ /// \param tests Total number of tests in all suites.\r
+ /// \param time Total elapsed time for all tests.\r
+ ///\r
+ virtual void finished(int tests, const Time& time)\r
+ {\r
+ CPPTEST_UNUSED(tests);\r
+ CPPTEST_UNUSED(time);\r
+ }\r
+\r
+ /// Called when a suite is entered.\r
+ ///\r
+ /// \param tests Number of tests in this suite.\r
+ /// \param name Name of the suite.\r
+ ///\r
+ virtual void suite_start(int tests, const std::string& name)\r
+ {\r
+ CPPTEST_UNUSED(tests);\r
+ CPPTEST_UNUSED(name);\r
+ }\r
+ \r
+ /// Called when a suite is finished.\r
+ ///\r
+ /// \param tests Number of tests in this suite.\r
+ /// \param name Name of the suite.\r
+ /// \param time Total elapsed time for all tests in this suite.\r
+ ///\r
+ virtual void suite_end(int tests, const std::string& name,\r
+ const Time& time)\r
+ {\r
+ CPPTEST_UNUSED(tests);\r
+ CPPTEST_UNUSED(name);\r
+ CPPTEST_UNUSED(time);\r
+ }\r
+ \r
+ /// Called when a tests is executed.\r
+ ///\r
+ /// \param name Name of the test function.\r
+ ///\r
+ virtual void test_start(const std::string& name)\r
+ {\r
+ CPPTEST_UNUSED(name);\r
+ }\r
+ \r
+ /// Called when a test if finished, regardless if an assertment was\r
+ /// issued.\r
+ ///\r
+ /// \param name Name of the test function.\r
+ /// \param ok True if the test was successful; false otherwise.\r
+ /// \param time Execution time.\r
+ ///\r
+ virtual void test_end(const std::string& name, bool ok,\r
+ const Time& time)\r
+ {\r
+ CPPTEST_UNUSED(name);\r
+ CPPTEST_UNUSED(ok);\r
+ CPPTEST_UNUSED(time);\r
+ }\r
+ \r
+ /// Called when an assertment is issued.\r
+ ///\r
+ /// \param s Assert point information.\r
+ ///\r
+ virtual void assertment(const Source& s)\r
+ {\r
+ CPPTEST_UNUSED(s);\r
+ }\r
+\r
+ protected:\r
+ /// Empty constructor.\r
+ ///\r
+ Output() {}\r
+ \r
+ private:\r
+ Output(const Output&);\r
+ Output& operator=(const Output&);\r
+ };\r
+ \r
+} // namespace Test\r
+ \r
+#endif // #ifndef CPPTEST_OUTPUT_H\r