MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / run_import_case

Function run_import_case

tests/test_extraction_imports.c:134–161  ·  view source on GitHub ↗

* Run one table entry; returns 0 on pass, 1 on failure. * Prints a diagnostic line on failure so failures are self-describing. */

Source from the content-addressed store, hash-verified

132 * Prints a diagnostic line on failure so failures are self-describing.
133 */
134static int run_import_case(const import_case_t *tc) {
135 CBMFileResult *r = do_extract(tc->src, tc->lang, tc->path);
136 if (!r) {
137 printf(" FAIL [%s]: cbm_extract_file returned NULL\n", tc->label);
138 return 1;
139 }
140 if (r->has_error) {
141 printf(" FAIL [%s]: extractor reported error\n", tc->label);
142 cbm_free_result(r);
143 return 1;
144 }
145 int fail = 0;
146 if (r->imports.count < tc->min_count) {
147 printf(" FAIL [%s]: imports.count=%d want>=%d\n",
148 tc->label, r->imports.count, tc->min_count);
149 fail = 1;
150 }
151 for (int e = 0; tc->expected[e] != NULL; e++) {
152 if (!imp_has(r, tc->expected[e])) {
153 printf(" FAIL [%s]: no import with module_path containing \"%s\" "
154 "(count=%d)\n",
155 tc->label, tc->expected[e], r->imports.count);
156 fail = 1;
157 }
158 }
159 cbm_free_result(r);
160 return fail;
161}
162
163/* Run an array of cases; accumulate failures and return total. */
164static int run_cases(const import_case_t *cases, int n) {

Callers 1

run_casesFunction · 0.85

Calls 3

do_extractFunction · 0.85
cbm_free_resultFunction · 0.85
imp_hasFunction · 0.85

Tested by

no test coverage detected