Add all asm files to test. Unfortunately, it crashes again. Will
[jitcs.git] / tests / unittest.h
blob10959cfc481a12df1774909bc6d0e084ada8c6d6
1 #ifndef _JITCS_TESTS_UNITTEST_H_
2 #define _JITCS_TESTS_UNITTEST_H_
4 #include "jitcs_base.h"
5 #include <string>
6 #include <list>
8 namespace jitcs {
10 class UnitTest {
11 public:
12 UnitTest();
14 void run(std::string const &testName, void (*testFnc)(UnitTest &));
15 void check(const char* subtestName, bool success);
17 size_t getNumberOfSuccessfulTests() const { return _numberOfSuccessfulTests; }
18 size_t getNumberOfFailedTests() const { return _numberOfFailedTests; }
20 private:
21 size_t _numberOfSuccessfulTests;
22 size_t _numberOfFailedTests;
23 std::string _nameOfCurrentTest;
25 class UnitTestRegistry {
26 public:
27 static UnitTestRegistry* get();
29 void registerTest(std::string const &testName, void (*testFnc)(UnitTest &));
30 void runTests(UnitTest &);
32 private:
33 UnitTestRegistry();
35 private:
36 typedef std::pair< std::string, void (*)(UnitTest &) > entryType;
37 typedef std::list< entryType > listType;
38 listType _tests;
41 struct UnitTestRun {
42 UnitTestRun(std::string const &testName, void (*testFnc)(UnitTest &));
44 } // end of namespace jitcs
46 #endif
47 // _JITCS_TESTS_UNITTEST_H_