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

tdeunittest

  • tdeunittest
module.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
31 #ifndef TDEUNITTEST_MODULE_H
32 #define TDEUNITTEST_MODULE_H
33 
34 #include <tqstring.h>
35 
36 #include <klibloader.h>
37 #include <tdeunittest/runner.h>
38 
39 namespace KUnitTest
40 {
50  #define TDEUNITTEST_MODULE(library,suite) \
51  static const TQString s_tdeunittest_suite = TQString::fromLatin1(suite); \
52  class library##Module : public TQObject \
53  { \
54  public: \
55  library##Module() \
56  { \
57  KUnitTest::RegistryIteratorType it(s_registry); \
58  for( ; it.current(); ++it ) \
59  KUnitTest::Runner::registerTester(it.currentKey(), it.current()); \
60  } \
61  \
62  static KUnitTest::RegistryType s_registry; \
63  }; \
64  \
65  KUnitTest::RegistryType library##Module::s_registry; \
66  \
67  void tdeunittest_registerModuleTester(const char *name, KUnitTest::Tester *test) \
68  { \
69  library##Module::s_registry.insert(name, test); \
70  } \
71  \
72  class module##Factory : public KLibFactory \
73  { \
74  public: \
75  TQObject *createObject (TQObject *, const char *, const char *, const TQStringList &) \
76  { \
77  return new library##Module(); \
78  }; \
79  }; \
80  \
81  K_EXPORT_COMPONENT_FACTORY( library, module##Factory )
82 
89  #define TDEUNITTEST_MODULE_REGISTER_TESTER( tester) \
90  static class tester##ModuleAutoregister \
91  { \
92  public: \
93  tester##ModuleAutoregister() \
94  { \
95  KUnitTest::Tester *test = new tester(); \
96  TQString name = s_tdeunittest_suite + TQString::fromLatin1("::") + TQString::fromLocal8Bit(#tester); \
97  test->setName(name.local8Bit()); \
98  tdeunittest_registerModuleTester(name.local8Bit(), test ); \
99  } \
100  } tester##ModuleAutoregisterInstance;
101 
107  #define TDEUNITTEST_MODULE_REGISTER_NAMEDTESTER( name , tester) \
108  static class tester##ModuleAutoregister \
109  { \
110  public: \
111  tester##ModuleAutoregister() \
112  { \
113  TQString fullName = s_tdeunittest_suite + TQString("::") + TQString::fromLocal8Bit(name); \
114  KUnitTest::Tester *test = new tester(fullName.local8Bit()); \
115  tdeunittest_registerModuleTester(fullName.local8Bit(), test); \
116  } \
117  } tester##ModuleAutoregisterInstance;
118 }
119 
120 #endif
runner.h
KUnitTest
Namespace for Unit testing classes.
Definition: module.h:39

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.