MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / registerTestMethods

Function registerTestMethods

extlibs/catch/include/catch/catch.hpp:4717–4746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4715 }
4716
4717 inline std::size_t registerTestMethods() {
4718 std::size_t noTestMethods = 0;
4719 int noClasses = objc_getClassList( nullptr, 0 );
4720
4721 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
4722 objc_getClassList( classes, noClasses );
4723
4724 for( int c = 0; c < noClasses; c++ ) {
4725 Class cls = classes[c];
4726 {
4727 u_int count;
4728 Method* methods = class_copyMethodList( cls, &count );
4729 for( u_int m = 0; m < count ; m++ ) {
4730 SEL selector = method_getName(methods[m]);
4731 std::string methodName = sel_getName(selector);
4732 if( startsWith( methodName, "Catch_TestCase_" ) ) {
4733 std::string testCaseName = methodName.substr( 15 );
4734 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
4735 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
4736 const char* className = class_getName( cls );
4737
4738 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
4739 noTestMethods++;
4740 }
4741 }
4742 free(methods);
4743 }
4744 }
4745 return noTestMethods;
4746 }
4747
4748#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
4749

Callers 1

mainFunction · 0.85

Calls 8

getAnnotationFunction · 0.85
makeTestCaseFunction · 0.85
NameAndTagsClass · 0.85
SourceLineInfoClass · 0.85
substrMethod · 0.80
startsWithFunction · 0.70
registerTestMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected