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

Function check_sources_exact

tests/repro/repro_issue787.c:285–311  ·  view source on GitHub ↗

Check that paths[] contains exactly the expected file suffixes, once each. * Returns 1 if all expected suffixes appear exactly once, 0 otherwise. * Prints a diagnostic on mismatch. */

Source from the content-addressed store, hash-verified

283 * Returns 1 if all expected suffixes appear exactly once, 0 otherwise.
284 * Prints a diagnostic on mismatch. */
285static int check_sources_exact(char **paths, int count,
286 const char **expected, int nexpected) {
287 if (count != nexpected) {
288 printf(" source count %d != expected %d\n", count, nexpected);
289 for (int i = 0; i < count; i++) {
290 printf(" got: %s\n", paths[i] ? paths[i] : "(null)");
291 }
292 return 0;
293 }
294 for (int e = 0; e < nexpected; e++) {
295 int seen = 0;
296 for (int i = 0; i < count; i++) {
297 if (paths[i] && strstr(paths[i], expected[e])) {
298 seen++;
299 }
300 }
301 if (seen != 1) {
302 printf(" expected suffix '%s' appears %d time(s) (want 1)\n",
303 expected[e], seen);
304 for (int i = 0; i < count; i++) {
305 printf(" got: %s\n", paths[i] ? paths[i] : "(null)");
306 }
307 return 0;
308 }
309 }
310 return 1;
311}
312
313/* Expected distinct USAGE source files (shared by all three tests). */
314static const char *k_expected[] = {

Callers 1

repro_issue787.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected