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

Function sh_pipeline_battery

tests/repro/repro_grammar_shells.c:327–372  ·  view source on GitHub ↗

── Shared full-pipeline battery (dims 7-8) ──────────────────────────────── * * Indexes the single-file fixture through the production pipeline and asserts * callable-sourcing (no Module-sourced in-body CALLS, and >= 1 callable-sourced * so a fixture with zero CALLS edges cannot vacuously pass) plus no dangling * CALLS endpoints. Used for the callable languages. Dim 7 is RED for the * langua

Source from the content-addressed store, hash-verified

325 * Returns 0 on PASS.
326 */
327static int sh_pipeline_battery(const char *lang_tag, const char *filename, const char *src) {
328 const char *RED = tf_red();
329 const char *RST = tf_reset();
330
331 RFile files[1];
332 files[0].name = filename;
333 files[0].content = src;
334
335 RProj lp;
336 cbm_store_t *store = rh_index_files(&lp, files, 1);
337 if (!store) {
338 printf(" %sFAIL%s [%s] pipeline: rh_index_files returned NULL\n",
339 RED, RST, lang_tag);
340 return 1;
341 }
342
343 int fails = 0;
344
345 /* 7. callable-sourcing */
346 int module_sourced = 0;
347 int callable_sourced = 0;
348 inv_count_calls_by_source(store, lp.project, &module_sourced, &callable_sourced);
349 if (module_sourced != 0) {
350 printf(" %sFAIL%s [%s] callable-sourcing: %d in-body CALLS sourced at "
351 "Module (callable=%d) -- enclosing-func gap (func_kinds_for_lang "
352 "lacks this grammar's func node type)\n",
353 RED, RST, lang_tag, module_sourced, callable_sourced);
354 fails++;
355 } else if (callable_sourced < 1) {
356 printf(" %sFAIL%s [%s] callable-sourcing: 0 CALLS edges (fixture "
357 "produced no in-body call edge to attribute)\n",
358 RED, RST, lang_tag);
359 fails++;
360 }
361
362 /* 8. no-dangling */
363 int dangling = inv_count_dangling_edges(store, lp.project, "CALLS");
364 if (dangling != 0) {
365 printf(" %sFAIL%s [%s] no-dangling: %d dangling CALLS endpoint(s)\n",
366 RED, RST, lang_tag, dangling);
367 fails++;
368 }
369
370 rh_cleanup(&lp, store);
371 return fails ? 1 : 0;
372}
373
374/* ── Robustness helper: assert call RETURNS on malformed input ──────────────
375 *

Callers 1

Calls 6

tf_redFunction · 0.85
tf_resetFunction · 0.85
rh_index_filesFunction · 0.85
inv_count_dangling_edgesFunction · 0.85
rh_cleanupFunction · 0.85

Tested by

no test coverage detected