nngn
Loading...
Searching...
No Matches
registry.h
Go to the documentation of this file.
1#ifndef NNGN_TEST_REGISTRY_H
2#define NNGN_TEST_REGISTRY_H
3
4#include <QTest>
5
7 using V = std::vector<std::unique_ptr<QObject>>;
8 static V &m_tests() { static V v; return v; }
9public:
10 static const V &tests() { return TestRegistry::m_tests(); }
11 template<typename T> struct R { R() { add<T>(); } };
12 template<typename T> static void add()
13 { TestRegistry::m_tests().push_back(std::make_unique<T>()); }
14};
15
16#define NNGN_TEST(T) static TestRegistry::R<T> NNGN_TEST_REGISTRATION_##T;
17
18#endif
Definition registry.h:6
std::vector< std::unique_ptr< QObject > > V
Definition registry.h:7
static V & m_tests()
Definition registry.h:8
static const V & tests()
Definition registry.h:10
static void add()
Definition registry.h:12
v[1]
Definition math.lua:22
Definition registry.h:11
R()
Definition registry.h:11