CppTest  Version 2.0.0
cpptest-textoutput.h
Go to the documentation of this file.
1 // ---
2 //
3 // $Id: cpptest-textoutput.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 
29 #ifndef CPPTEST_TEXTOUTPUT_H
30 #define CPPTEST_TEXTOUTPUT_H
31 
32 #include <iostream>
33 #include <list>
34 
35 #include "cpptest-source.h"
36 #include "cpptest-output.h"
37 
38 namespace Test
39 {
46  class TextOutput : public Output
47  {
48  public:
51  enum Mode
52  {
56 
61  };
62 
63  TextOutput(Mode mode, std::ostream& stream = std::cout);
64 
65  virtual void finished(int tests, const Time& time);
66  virtual void suite_start(int tests, const std::string& name);
67  virtual void suite_end(int tests, const std::string& name,
68  const Time& time);
69  virtual void test_end(const std::string& name, bool ok,
70  const Time& time);
71  virtual void assertment(const Source& s);
72 
73  private:
74  typedef std::list<Source> ErrorList;
75 
76  Mode _mode;
77  std::ostream& _stream;
78  ErrorList _suite_error_list;
79  std::string _suite_name;
80  int _suite_errors;
81  int _suite_tests;
82  int _suite_total_tests;
83  int _total_errors;
84  };
85 
86 } // namespace Test
87 
88 #endif // #ifndef CPPTEST_TEXTOUTPUT_H
TextOutput(Mode mode, std::ostream &stream=std::cout)
Definition: textoutput.cpp:69
Text output handler that outputs to the a stream.
Definition: cpptest-textoutput.h:46
virtual void suite_end(int tests, const std::string &name, const Time &time)
Definition: textoutput.cpp:100
Time representation.
Definition: cpptest-time.h:43
Definition: cpptest-textoutput.h:60
Assertment source information.
Definition: cpptest-source.h:42
Definition: cpptest-textoutput.h:55
virtual void suite_start(int tests, const std::string &name)
Definition: textoutput.cpp:84
virtual void assertment(const Source &s)
Definition: textoutput.cpp:127
Definition: collectoroutput.cpp:37
virtual void finished(int tests, const Time &time)
Definition: textoutput.cpp:76
virtual void test_end(const std::string &name, bool ok, const Time &time)
Definition: textoutput.cpp:117
Test suite output handler.
Definition: cpptest-output.h:55
Mode
Definition: cpptest-textoutput.h:51