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
6
class
TestRegistry
{
7
using
V
= std::vector<std::unique_ptr<QObject>>;
8
static
V
&
m_tests
() {
static
V
v
;
return
v
; }
9
public
:
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
TestRegistry
Definition
registry.h:6
TestRegistry::V
std::vector< std::unique_ptr< QObject > > V
Definition
registry.h:7
TestRegistry::m_tests
static V & m_tests()
Definition
registry.h:8
TestRegistry::tests
static const V & tests()
Definition
registry.h:10
TestRegistry::add
static void add()
Definition
registry.h:12
v
v[1]
Definition
math.lua:22
TestRegistry::R
Definition
registry.h:11
TestRegistry::R::R
R()
Definition
registry.h:11
tests
registry.h
Generated by
1.11.0