| 4848 | } |
| 4849 | |
| 4850 | inline std::size_t registerTestMethods() { |
| 4851 | std::size_t noTestMethods = 0; |
| 4852 | int noClasses = objc_getClassList( nullptr, 0 ); |
| 4853 | |
| 4854 | Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); |
| 4855 | objc_getClassList( classes, noClasses ); |
| 4856 | |
| 4857 | for( int c = 0; c < noClasses; c++ ) { |
| 4858 | Class cls = classes[c]; |
| 4859 | { |
| 4860 | u_int count; |
| 4861 | Method* methods = class_copyMethodList( cls, &count ); |
| 4862 | for( u_int m = 0; m < count ; m++ ) { |
| 4863 | SEL selector = method_getName(methods[m]); |
| 4864 | std::string methodName = sel_getName(selector); |
| 4865 | if( startsWith( methodName, "Catch_TestCase_" ) ) { |
| 4866 | std::string testCaseName = methodName.substr( 15 ); |
| 4867 | std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); |
| 4868 | std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); |
| 4869 | const char* className = class_getName( cls ); |
| 4870 | |
| 4871 | getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) ); |
| 4872 | noTestMethods++; |
| 4873 | } |
| 4874 | } |
| 4875 | free(methods); |
| 4876 | } |
| 4877 | } |
| 4878 | return noTestMethods; |
| 4879 | } |
| 4880 | |
| 4881 | #if !defined(CATCH_CONFIG_DISABLE_MATCHERS) |
| 4882 |
no test coverage detected