CppTest home page CppTest project page

cpptest-textoutput.h

Go to the documentation of this file.
00001 // ---
00002 //
00003 // $Id: cpptest-textoutput.h,v 1.3 2005/06/08 08:08:06 nilu Exp $
00004 //
00005 // CppTest - A C++ Unit Testing Framework
00006 // Copyright (c) 2003 Niklas Lundell
00007 //
00008 // ---
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the
00022 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023 // Boston, MA 02111-1307, USA.
00024 //
00025 // ---
00026 
00029 #ifndef CPPTEST_TEXTOUTPUT_H
00030 #define CPPTEST_TEXTOUTPUT_H
00031 
00032 #include <iostream>
00033 #include <list>
00034 
00035 #include "cpptest-source.h"
00036 #include "cpptest-output.h"
00037 
00038 namespace Test
00039 {
00046     class TextOutput : public Output
00047     {
00048     public:
00051         enum Mode
00052         {
00055             Terse,
00056             
00060             Verbose         
00061         };
00062         
00063         TextOutput(Mode mode, std::ostream& stream = std::cout);
00064         
00065         virtual void finished(int tests, const Time& time);
00066         virtual void suite_start(int tests, const std::string& name);
00067         virtual void suite_end(int tests, const std::string& name,
00068                                const Time& time);
00069         virtual void test_end(const std::string& name, bool ok,
00070                               const Time& time);
00071         virtual void assertment(const Source& s);
00072         
00073     private:
00074         typedef std::list<Source> ErrorList;
00075         
00076         Mode            _mode;
00077         std::ostream&   _stream;
00078         ErrorList       _suite_error_list;
00079         std::string     _suite_name;
00080         int             _suite_errors;
00081         int             _suite_tests;
00082         int             _suite_total_tests;
00083         int             _total_errors;
00084     };
00085 
00086 } // namespace Test
00087     
00088 #endif // #ifndef CPPTEST_TEXTOUTPUT_H

Supported by:

SourceForge Logo