MCPcopy Create free account
hub / github.com/FidoProject/Fido / registerTestMethods

Function registerTestMethods

tests/catch.h:2940–2969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2938 }
2939
2940 inline size_t registerTestMethods() {
2941 size_t noTestMethods = 0;
2942 int noClasses = objc_getClassList( CATCH_NULL, 0 );
2943
2944 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
2945 objc_getClassList( classes, noClasses );
2946
2947 for( int c = 0; c < noClasses; c++ ) {
2948 Class cls = classes[c];
2949 {
2950 u_int count;
2951 Method* methods = class_copyMethodList( cls, &count );
2952 for( u_int m = 0; m < count ; m++ ) {
2953 SEL selector = method_getName(methods[m]);
2954 std::string methodName = sel_getName(selector);
2955 if( startsWith( methodName, "Catch_TestCase_" ) ) {
2956 std::string testCaseName = methodName.substr( 15 );
2957 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
2958 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
2959 const char* className = class_getName( cls );
2960
2961 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo() ) );
2962 noTestMethods++;
2963 }
2964 }
2965 free(methods);
2966 }
2967 }
2968 return noTestMethods;
2969 }
2970
2971 namespace Matchers {
2972 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