fork
Fork of cpputest by
Embed:
(wiki syntax)
Show/hide line numbers
TestRegistry.h
00001 /* 00002 * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * * Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * * Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * * Neither the name of the <organization> nor the 00013 * names of its contributors may be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY 00017 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY 00020 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 /////////////////////////////////////////////////////////////////////////////// 00029 // 00030 // TestRegistry is a collection of tests that can be run 00031 // 00032 00033 #ifndef D_TestRegistry_h 00034 #define D_TestRegistry_h 00035 00036 #include "SimpleString.h" 00037 #include "TestFilter.h" 00038 00039 class UtestShell; 00040 class TestResult; 00041 class TestPlugin; 00042 00043 class TestRegistry 00044 { 00045 public: 00046 TestRegistry(); 00047 virtual ~TestRegistry(); 00048 00049 virtual void addTest(UtestShell *test); 00050 virtual void unDoLastAddTest(); 00051 virtual int countTests(); 00052 virtual void runAllTests(TestResult& result); 00053 virtual void nameFilter(const TestFilter& filter); 00054 virtual void groupFilter(const TestFilter& filter); 00055 00056 virtual void installPlugin(TestPlugin* plugin); 00057 virtual void resetPlugins(); 00058 virtual TestPlugin* getFirstPlugin(); 00059 virtual TestPlugin* getPluginByName(const SimpleString& name); 00060 virtual void removePluginByName(const SimpleString& name); 00061 virtual int countPlugins(); 00062 00063 TestFilter getGroupFilter(); 00064 TestFilter getNameFilter(); 00065 00066 virtual UtestShell* getFirstTest(); 00067 virtual UtestShell* getLastTest(); 00068 virtual UtestShell* getTestWithNext(UtestShell* test); 00069 00070 virtual UtestShell* findTestWithName(const SimpleString& name); 00071 virtual UtestShell* findTestWithGroup(const SimpleString& name); 00072 00073 static TestRegistry* getCurrentRegistry(); 00074 virtual void setCurrentRegistry(TestRegistry* registry); 00075 00076 virtual void setRunTestsInSeperateProcess(); 00077 private: 00078 00079 bool testShouldRun(UtestShell* test, TestResult& result); 00080 bool endOfGroup(UtestShell* test); 00081 00082 UtestShell * tests_; 00083 TestFilter nameFilter_; 00084 TestFilter groupFilter_; 00085 TestPlugin* firstPlugin_; 00086 static TestRegistry* currentRegistry_; 00087 bool runInSeperateProcess_; 00088 00089 }; 00090 00091 #endif
Generated on Tue Jul 12 2022 21:37:56 by 1.7.2