1 #ifndef _JITCS_TESTS_UNITTEST_H_
2 #define _JITCS_TESTS_UNITTEST_H_
4 #include "jitcs_base.h"
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
; }
21 size_t _numberOfSuccessfulTests
;
22 size_t _numberOfFailedTests
;
23 std::string _nameOfCurrentTest
;
25 class UnitTestRegistry
{
27 static UnitTestRegistry
* get();
29 void registerTest(std::string
const &testName
, void (*testFnc
)(UnitTest
&));
30 void runTests(UnitTest
&);
36 typedef std::pair
< std::string
, void (*)(UnitTest
&) > entryType
;
37 typedef std::list
< entryType
> listType
;
42 UnitTestRun(std::string
const &testName
, void (*testFnc
)(UnitTest
&));
44 } // end of namespace jitcs
47 // _JITCS_TESTS_UNITTEST_H_