MCPcopy Create free account
hub / github.com/cirquit/trdrop / registerTestMethods

Function registerTestMethods

ext/catch.hpp:3272–3301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3270 }
3271
3272 inline size_t registerTestMethods() {
3273 size_t noTestMethods = 0;
3274 int noClasses = objc_getClassList( CATCH_NULL, 0 );
3275
3276 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
3277 objc_getClassList( classes, noClasses );
3278
3279 for( int c = 0; c < noClasses; c++ ) {
3280 Class cls = classes[c];
3281 {
3282 u_int count;
3283 Method* methods = class_copyMethodList( cls, &count );
3284 for( u_int m = 0; m < count ; m++ ) {
3285 SEL selector = method_getName(methods[m]);
3286 std::string methodName = sel_getName(selector);
3287 if( startsWith( methodName, "Catch_TestCase_" ) ) {
3288 std::string testCaseName = methodName.substr( 15 );
3289 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
3290 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
3291 const char* className = class_getName( cls );
3292
3293 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo() ) );
3294 noTestMethods++;
3295 }
3296 }
3297 free(methods);
3298 }
3299 }
3300 return noTestMethods;
3301 }
3302
3303 namespace Matchers {
3304 namespace Impl {

Callers 1

mainFunction · 0.85

Calls 5

startsWithFunction · 0.85
getAnnotationFunction · 0.85
makeTestCaseFunction · 0.85
SourceLineInfoClass · 0.85
registerTestMethod · 0.45

Tested by

no test coverage detected