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

Function registerTestMethods

unittests/catch.hpp:2911–2940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2909 }
2910
2911 inline std::size_t registerTestMethods() {
2912 std::size_t noTestMethods = 0;
2913 int noClasses = objc_getClassList( nullptr, 0 );
2914
2915 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
2916 objc_getClassList( classes, noClasses );
2917
2918 for( int c = 0; c < noClasses; c++ ) {
2919 Class cls = classes[c];
2920 {
2921 u_int count;
2922 Method* methods = class_copyMethodList( cls, &count );
2923 for( u_int m = 0; m < count ; m++ ) {
2924 SEL selector = method_getName(methods[m]);
2925 std::string methodName = sel_getName(selector);
2926 if( startsWith( methodName, "Catch_TestCase_" ) ) {
2927 std::string testCaseName = methodName.substr( 15 );
2928 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
2929 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
2930 const char* className = class_getName( cls );
2931
2932 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) );
2933 noTestMethods++;
2934 }
2935 }
2936 free(methods);
2937 }
2938 }
2939 return noTestMethods;
2940 }
2941
2942#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
2943

Callers 1

mainFunction · 0.85

Calls 7

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

Tested by

no test coverage detected