00001 #ifndef __KDAB__UNITTEST__TESTREGISTRY_H__ 00002 #define __KDAB__UNITTEST__TESTREGISTRY_H__ 00003 00004 #ifndef KDAB_NO_UNIT_TESTS 00005 00006 #include <string> 00007 #include <map> 00008 #include <vector> 00009 #include <cassert> 00010 00011 #include "../../kdchart_export.h" 00012 00013 namespace KDAB { 00014 namespace UnitTest { 00015 00016 class Test; 00017 class TestFactory; 00018 00019 class KDCHART_EXPORT TestRegistry { 00020 friend class ::KDAB::UnitTest::TestFactory; 00021 static TestRegistry * mSelf; 00022 TestRegistry(); 00023 ~TestRegistry(); 00024 public: 00025 static TestRegistry * instance(); 00026 static void deleteInstance(); 00027 00028 void registerTestFactory( const TestFactory * tf, const char * group ); 00029 00032 unsigned int run() const; 00035 unsigned int run( const char * group ) const; 00036 00037 private: 00038 std::map< std::string, std::vector<const TestFactory*> > mTests; 00039 }; 00040 00041 class KDCHART_EXPORT Runner { 00042 public: 00043 ~Runner(); 00044 unsigned int run( const char * group=0 ) const; 00045 }; 00046 00047 } 00048 } 00049 00050 #endif // KDAB_NO_UNIT_TESTS 00051 00052 #endif // __KDAB__UNITTEST__TESTREGISTRY_H__