MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / registerTestMethods

Function registerTestMethods

Bcore/src/main/cpp/Dobby/tests/catch.hpp:2772–2802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2770} // namespace Detail
2771
2772inline std::size_t registerTestMethods() {
2773 std::size_t noTestMethods = 0;
2774 int noClasses = objc_getClassList(nullptr, 0);
2775
2776 Class *classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc(sizeof(Class) * noClasses);
2777 objc_getClassList(classes, noClasses);
2778
2779 for (int c = 0; c < noClasses; c++) {
2780 Class cls = classes[c];
2781 {
2782 u_int count;
2783 Method *methods = class_copyMethodList(cls, &count);
2784 for (u_int m = 0; m < count; m++) {
2785 SEL selector = method_getName(methods[m]);
2786 std::string methodName = sel_getName(selector);
2787 if (startsWith(methodName, "Catch_TestCase_")) {
2788 std::string testCaseName = methodName.substr(15);
2789 std::string name = Detail::getAnnotation(cls, "Name", testCaseName);
2790 std::string desc = Detail::getAnnotation(cls, "Description", testCaseName);
2791 const char *className = class_getName(cls);
2792
2793 getMutableRegistryHub().registerTest(
2794 makeTestCase(new OcMethod(cls, selector), className, name.c_str(), desc.c_str(), SourceLineInfo("", 0)));
2795 noTestMethods++;
2796 }
2797 }
2798 free(methods);
2799 }
2800 }
2801 return noTestMethods;
2802}
2803
2804#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
2805

Callers 1

mainFunction · 0.85

Calls 7

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

Tested by

no test coverage detected