Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
45
libs/testing/testregister.hpp
Normal file
45
libs/testing/testregister.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
class TestRegister
|
||||
{
|
||||
public:
|
||||
TestRegister(char const * testname, char const * filename, std::function<void()> && fnTest)
|
||||
: m_testname(testname)
|
||||
, m_filename(filename)
|
||||
, m_fn(std::move(fnTest))
|
||||
, m_next(nullptr)
|
||||
{
|
||||
if (FirstRegister() == nullptr)
|
||||
{
|
||||
FirstRegister() = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
TestRegister * last = FirstRegister();
|
||||
while (last->m_next != nullptr)
|
||||
last = last->m_next;
|
||||
last->m_next = this;
|
||||
}
|
||||
}
|
||||
|
||||
static TestRegister *& FirstRegister()
|
||||
{
|
||||
static TestRegister * test = nullptr;
|
||||
return test;
|
||||
}
|
||||
|
||||
// Test name.
|
||||
char const * m_testname;
|
||||
|
||||
// File name.
|
||||
char const * m_filename;
|
||||
|
||||
// Function to run test.
|
||||
std::function<void()> m_fn;
|
||||
|
||||
// Next test in chain.
|
||||
TestRegister * m_next;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue