Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

/home/tommi/cxxtools/include/cxxtools/unit/application.h

00001 /*
00002  * Copyright (C) 2005-2008 by Dr. Marc Boris Duerner
00003  * 
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  * 
00009  * As a special exception, you may use this file as part of a free
00010  * software library without restriction. Specifically, if other files
00011  * instantiate templates or use macros or inline functions from this
00012  * file, or you compile this file and link it with other files to
00013  * produce an executable, this file does not by itself cause the
00014  * resulting executable to be covered by the GNU General Public
00015  * License. This exception does not however invalidate any other
00016  * reasons why the executable file might be covered by the GNU Library
00017  * General Public License.
00018  * 
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Lesser General Public License for more details.
00023  * 
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this library; if not, write to the Free Software
00026  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00027  */
00028 #ifndef CXXTOOLS_UNIT_APPLICATION_H
00029 #define CXXTOOLS_UNIT_APPLICATION_H
00030 
00031 #include <cxxtools/unit/reporter.h>
00032 #include <cxxtools/unit/test.h>
00033 #include <sstream>
00034 
00035 namespace cxxtools {
00036 
00037 namespace unit {
00038 
00061     class Application : public Test
00062     {
00063         public:
00066             Application();
00067 
00070             virtual ~Application();
00071 
00072             static Application& instance();
00073 
00078             Test* findTest(const std::string& testname);
00079 
00084             void attachReporter(Reporter& r);
00085 
00091             void attachReporter(Reporter& r, const std::string& testname);
00092 
00100             void run(const std::string& testName);
00101 
00108             virtual void run();
00109 
00111             unsigned errors() const
00112             { return _errors; }
00113 
00118             static std::list<Test*>& tests();
00119 
00127             void registerTest(Test& test);
00128 
00129             void deregisterTest(Test& test);
00130 
00131         private:
00132             static Application* _app;
00133 
00136             unsigned _errors;
00137     };
00138 
00139 } // namespace unit
00140 
00141 } // namespace cxxtools
00142 
00143 #endif
Copyright © 2008 The Tntnet Development Team
Tntnet 1.6