+// ---\r
+//\r
+// $Id: cpptest-textoutput.h,v 1.3 2005/06/08 08:08:06 nilu 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_TEXTOUTPUT_H\r
+#define CPPTEST_TEXTOUTPUT_H\r
+\r
+#include <iostream>\r
+#include <list>\r
+\r
+#include "cpptest-source.h"\r
+#include "cpptest-output.h"\r
+\r
+namespace Test\r
+{\r
+ /// \brief Text output handler that outputs to the a stream.\r
+ ///\r
+ /// %Test suite output handler that writes its information as text to a\r
+ /// a stream. It it possible to select between two different operational\r
+ /// modes that controls the detail level, see Mode.\r
+ ///\r
+ class TextOutput : public Output\r
+ {\r
+ public:\r
+ /// Output mode.\r
+ ///\r
+ enum Mode\r
+ {\r
+ /// Terse output mode, which only shows the number of correct tests.\r
+ ///\r
+ Terse,\r
+ \r
+ /// Verbose output mode, which also shows extended assert\r
+ /// information for each test that failed.\r
+ ///\r
+ Verbose \r
+ };\r
+ \r
+ TextOutput(Mode mode, std::ostream& stream = std::cout);\r
+ \r
+ virtual void finished(int tests, const Time& time);\r
+ virtual void suite_start(int tests, const std::string& name);\r
+ virtual void suite_end(int tests, const std::string& name,\r
+ const Time& time);\r
+ virtual void test_end(const std::string& name, bool ok,\r
+ const Time& time);\r
+ virtual void assertment(const Source& s);\r
+ \r
+ private:\r
+ typedef std::list<Source> ErrorList;\r
+ \r
+ Mode _mode;\r
+ std::ostream& _stream;\r
+ ErrorList _suite_error_list;\r
+ std::string _suite_name;\r
+ int _suite_errors;\r
+ int _suite_tests;\r
+ int _suite_total_tests;\r
+ int _total_errors;\r
+ };\r
+\r
+} // namespace Test\r
+ \r
+#endif // #ifndef CPPTEST_TEXTOUTPUT_H\r