| 3349 | } |
| 3350 | |
| 3351 | inline size_t registerTestMethods() { |
| 3352 | size_t noTestMethods = 0; |
| 3353 | int noClasses = objc_getClassList( CATCH_NULL, 0 ); |
| 3354 | |
| 3355 | Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); |
| 3356 | objc_getClassList( classes, noClasses ); |
| 3357 | |
| 3358 | for( int c = 0; c < noClasses; c++ ) { |
| 3359 | Class cls = classes[c]; |
| 3360 | { |
| 3361 | u_int count; |
| 3362 | Method* methods = class_copyMethodList( cls, &count ); |
| 3363 | for( u_int m = 0; m < count ; m++ ) { |
| 3364 | SEL selector = method_getName(methods[m]); |
| 3365 | std::string methodName = sel_getName(selector); |
| 3366 | if( startsWith( methodName, "Catch_TestCase_" ) ) { |
| 3367 | std::string testCaseName = methodName.substr( 15 ); |
| 3368 | std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); |
| 3369 | std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); |
| 3370 | const char* className = class_getName( cls ); |
| 3371 | |
| 3372 | getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo() ) ); |
| 3373 | noTestMethods++; |
| 3374 | } |
| 3375 | } |
| 3376 | free(methods); |
| 3377 | } |
| 3378 | } |
| 3379 | return noTestMethods; |
| 3380 | } |
| 3381 | |
| 3382 | namespace Matchers { |
| 3383 | namespace Impl { |
no test coverage detected