module.h File Reference
Detailed Description
Provides macros to ease building unit tests as shared librariesDefinition in file module.h.
#include <qstring.h>
#include <klibloader.h>
#include <kunittest/runner.h>
Go to the source code of this file.
Namespaces | |
namespace | KUnitTest |
Defines | |
#define | KUNITTEST_MODULE(library, suite) |
#define | KUNITTEST_MODULE_REGISTER_TESTER(tester) |
#define | KUNITTEST_MODULE_REGISTER_NAMEDTESTER(name, tester) |
Define Documentation
#define KUNITTEST_MODULE | ( | library, | |||
suite | ) |
Use this macro if you are creating a KUnitTest module named library. This macro creates a module-class named a factory class. The module will appear under the name suite in the test runner. There is no need in calling the K_EXPORT_COMPONENT_FACTORY macro, this is taken care of automatically.
KUNITTEST_MODULE(kunittest_samplemodule,"TestSuite")
#define KUNITTEST_MODULE_REGISTER_NAMEDTESTER | ( | name, | |||
tester | ) |
Value:
static class tester##ModuleAutoregister \ { \ public: \ tester##ModuleAutoregister() \ { \ QString fullName = s_kunittest_suite + QString("::") + QString::fromLocal8Bit(name); \ KUnitTest::Tester *test = new tester(fullName.local8Bit()); \ kunittest_registerModuleTester(fullName.local8Bit(), test); \ } \ } tester##ModuleAutoregisterInstance;
KUNITTEST_MODULE_REGISTER_TESTER("SubSuite::PrettyName",SimpleSampleTester)
#define KUNITTEST_MODULE_REGISTER_TESTER | ( | tester | ) |
Value:
static class tester##ModuleAutoregister \ { \ public: \ tester##ModuleAutoregister() \ { \ KUnitTest::Tester *test = new tester(); \ QString name = s_kunittest_suite + QString::fromLatin1("::") + QString::fromLocal8Bit(#tester); \ test->setName(name.local8Bit()); \ kunittest_registerModuleTester(name.local8Bit(), test ); \ } \ } tester##ModuleAutoregisterInstance;
KUNITTEST_MODULE_REGISTER_TESTER(SimpleSampleTester)