KGantt

testregistry.h
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KGantt library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef __KDAB__UNITTEST__TESTREGISTRY_H__
10#define __KDAB__UNITTEST__TESTREGISTRY_H__
11
12#ifndef KDAB_NO_UNIT_TESTS
13
14#include "../kganttglobal.h"
15
16#include <string>
17#include <map>
18#include <vector>
19#include <cassert>
20
21namespace KDAB {
22namespace UnitTest {
23
24 class Test;
25 class TestFactory;
26
27 class KGANTT_EXPORT TestRegistry {
28 friend class ::KDAB::UnitTest::TestFactory;
29 static TestRegistry * mSelf;
30 TestRegistry();
31 ~TestRegistry();
32 public:
33 static TestRegistry * instance();
34 static void deleteInstance();
35
36 void registerTestFactory( const TestFactory * tf, const char * group );
37
38 /*! runs all tests in all groups.
39 @return the number of failed tests (if any) */
40 unsigned int run() const;
41 /*! runs only tests in group \a group
42 @return the number of failed tests (if any) */
43 unsigned int run( const char * group ) const;
44
45 private:
46 std::map< std::string, std::vector<const TestFactory*> > mTests;
47 };
48
49 class KGANTT_EXPORT Runner {
50 public:
51 ~Runner();
52 unsigned int run( const char * group = nullptr ) const;
53 };
54
55}
56}
57
58#endif // KDAB_NO_UNIT_TESTS
59
60#endif // __KDAB__UNITTEST__TESTREGISTRY_H__
Contains KGantt macros.
QFuture< T > run(Function function,...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:54:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.