Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'testing/testregister.hpp')
-rw-r--r--testing/testregister.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/testregister.hpp b/testing/testregister.hpp
new file mode 100644
index 0000000000..803413473a
--- /dev/null
+++ b/testing/testregister.hpp
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "../base/base.hpp"
+
+class TestRegister
+{
+public:
+ TestRegister(char const * testName, char const * fileName, void (* fnTest)())
+ : m_TestName(testName), m_FileName(fileName), m_Fn(fnTest), m_pNext(NULL)
+ {
+ if (FirstRegister() == NULL)
+ FirstRegister() = this;
+ else
+ {
+ TestRegister * pLast = FirstRegister();
+ while (pLast->m_pNext)
+ pLast = pLast->m_pNext;
+ pLast->m_pNext = this;
+ }
+ }
+
+ // Test name.
+ char const * m_TestName;
+ // File name.
+ char const * m_FileName;
+ // Function to run test.
+ void (* m_Fn)();
+ // Next test in chain.
+ TestRegister * m_pNext;
+
+ static TestRegister * & FirstRegister()
+ {
+ static TestRegister * s_pRegister = 0;
+ return s_pRegister;
+ }
+};