• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeunittest
 

tdeunittest

  • tdeunittest
runner.h
Go to the documentation of this file.
1 /*
2  * tdeunittest.h
3  *
4  * Copyright (C) 2004 Zack Rusin <zack@kde.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
33 #ifndef TDEUNITTEST_RUNNER_H
34 #define TDEUNITTEST_RUNNER_H
35 
36 #include <iostream>
37 using namespace std;
38 
39 #include <tqobject.h>
40 #include <tqasciidict.h>
41 #include <tqstring.h>
42 
43 #include <tdelibs_export.h>
44 
45 #include "tester.h"
46 
47 class TQSocketNotifier;
48 
49 namespace KUnitTest
50 {
56  #define TDEUNITTEST_SUITE(suite)\
57  static const TQString s_tdeunittest_suite = suite;
58 
68  #define TDEUNITTEST_REGISTER_TESTER( tester )\
69  static TesterAutoregister tester##Autoregister( TQString(s_tdeunittest_suite + TQString("::") + TQString::fromLocal8Bit(#tester)).local8Bit() , new tester ())
70 
71  #define TDEUNITTEST_REGISTER_NAMEDTESTER( name, tester )\
72  static TesterAutoregister tester##Autoregister( TQString(s_tdeunittest_suite + TQString("::") + TQString::fromLocal8Bit(name)).local8Bit() , new tester ())
73 
75  typedef TQAsciiDict<Tester> RegistryType;
76 
78  typedef TQAsciiDictIterator<Tester> RegistryIteratorType;
79 
97  class TDEUNITTEST_EXPORT Runner : public TQObject
98  {
99  Q_OBJECT
100 
101  public:
106  static void registerTester(const char *name, Tester *test);
107 
110  RegistryType &registry();
111 
114  static Runner *self();
115 
118  int numberOfTestCases();
119 
124  static void loadModules(const TQString &folder, const TQString &query);
125 
132  static void setDebugCapturingEnabled(bool enabled);
133 
134  private:
135  RegistryType m_registry;
136  static Runner *s_self;
137  static bool s_debugCapturingEnabled;
138 
139  protected:
140  Runner();
141 
142  public:
144  int numberOfTests() const;
145 
147  int numberOfPassedTests() const;
148 
150  int numberOfFailedTests() const;
151 
153  int numberOfExpectedFailures() const;
154 
156  int numberOfSkippedTests() const;
157 
158  public slots:
162  int runTests();
163 
169  void runTest(const char *name);
170 
174  void runMatchingTests(const TQString &prefix);
175 
178  void reset();
179 
180  signals:
185  void finished(const char *name, Tester *test);
186  void invoke();
187 
188  private:
189  void registerTests();
190 
191  private:
192  int globalSteps;
193  int globalTests;
194  int globalPasses;
195  int globalFails;
196  int globalXFails;
197  int globalXPasses;
198  int globalSkipped;
199  };
200 
204  class TesterAutoregister
205  {
206  public:
210  TesterAutoregister(const char *name, Tester *test)
211  {
212  if ( test->name() == 0L ) test->setName(name);
213  Runner::registerTester(name, test);
214  }
215  };
216 
217 }
218 
219 #endif
KUnitTest::Tester
Definition: tester.h:522
KUnitTest::TesterAutoregister::TesterAutoregister
TesterAutoregister(const char *name, Tester *test)
Definition: runner.h:210
tester.h
std
KUnitTest::TesterAutoregister
Definition: runner.h:204
KUnitTest
Namespace for Unit testing classes.
Definition: module.h:39
KUnitTest::Runner
Definition: runner.h:97
KUnitTest::RegistryIteratorType
TQAsciiDictIterator< Tester > RegistryIteratorType
Definition: runner.h:78
KUnitTest::RegistryType
TQAsciiDict< Tester > RegistryType
Definition: runner.h:75

tdeunittest

Skip menu "tdeunittest"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

tdeunittest

Skip menu "tdeunittest"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeunittest by doxygen 1.8.8
This website is maintained by Timothy Pearson.