31 #ifndef TDEUNITTEST_MODULE_H
32 #define TDEUNITTEST_MODULE_H
36 #include <klibloader.h>
50 #define TDEUNITTEST_MODULE(library,suite) \
51 static const TQString s_tdeunittest_suite = TQString::fromLatin1(suite); \
52 class library##Module : public TQObject \
57 KUnitTest::RegistryIteratorType it(s_registry); \
58 for( ; it.current(); ++it ) \
59 KUnitTest::Runner::registerTester(it.currentKey(), it.current()); \
62 static KUnitTest::RegistryType s_registry; \
65 KUnitTest::RegistryType library##Module::s_registry; \
67 void tdeunittest_registerModuleTester(const char *name, KUnitTest::Tester *test) \
69 library##Module::s_registry.insert(name, test); \
72 class module##Factory : public KLibFactory \
75 TQObject *createObject (TQObject *, const char *, const char *, const TQStringList &) \
77 return new library##Module(); \
81 K_EXPORT_COMPONENT_FACTORY( library, module##Factory )
89 #define TDEUNITTEST_MODULE_REGISTER_TESTER( tester) \
90 static class tester##ModuleAutoregister \
93 tester##ModuleAutoregister() \
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 ); \
100 } tester##ModuleAutoregisterInstance;
107 #define TDEUNITTEST_MODULE_REGISTER_NAMEDTESTER( name , tester) \
108 static class tester##ModuleAutoregister \
111 tester##ModuleAutoregister() \
113 TQString fullName = s_tdeunittest_suite + TQString("::") + TQString::fromLocal8Bit(name); \
114 KUnitTest::Tester *test = new tester(fullName.local8Bit()); \
115 tdeunittest_registerModuleTester(fullName.local8Bit(), test); \
117 } tester##ModuleAutoregisterInstance;
Namespace for Unit testing classes.