ACF $AcfVersion:0$
CStandardTestExecutor.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QObject>
7#include <QtCore/QVector>
8
9// ACF includes
10#include <istd/TSmartPtr.h>
11#include <itest/ITestExecutor.h>
12
13
14namespace itest
15{
16
17
22{
23public:
24 // reimplemented (ITestExecutor)
25 virtual int RunTests(int argc, char *argv[]) override;
26
27public:
28 template <class TestObject>
30 {
31 public:
32 TestRegistrator(const QString& name)
33 {
34 TestPtr testPtr(new TestObject);
35
36 testPtr->setObjectName(name);
37
38 AddTest(testPtr);
39 }
40 };
41
42private:
43 typedef istd::TSmartPtr<QObject> TestPtr;
44 typedef QVector<TestPtr> TestInstances;
45
46 static TestInstances& GetTests();
47 static bool FindTest(const QString& name);
48 static void AddTest(TestPtr test);
49};
50
51
52} // namespace itest
53
54#define I_ADD_TEST(className) const itest::CStandardTestExecutor::TestRegistrator<className> className##_AddTest(#className);
55
56
Standard implementation of ITestExecutor with static test registration.
virtual int RunTests(int argc, char *argv[]) override
Interface for running a collection of tests.
Contains interfaces and implementations of testing-related components.