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

Function pipeline_battery

tests/repro/repro_grammar_functional.c:147–194  ·  view source on GitHub ↗

-- Shared full-pipeline battery (dimensions 7-8) ------------------------ * * Indexes the single-file fixture through the production pipeline and asserts * callable-sourcing (no Module-sourced in-body CALLS) and no dangling CALLS * edges. Returns 0 on PASS, 1 on FAIL. Dimension 7 is RED for all functional * languages on current code -- that is the intended signal. */

Source from the content-addressed store, hash-verified

145 * languages on current code -- that is the intended signal.
146 */
147static int pipeline_battery(const char *lang_tag, const char *filename,
148 const char *src) {
149 const char *RED = tf_red();
150 const char *RST = tf_reset();
151
152 RFile files[1];
153 files[0].name = filename;
154 files[0].content = src;
155
156 RProj lp;
157 cbm_store_t *store = rh_index_files(&lp, files, 1);
158 if (!store) {
159 printf(" %sFAIL%s [%s] pipeline: rh_index_files returned NULL\n",
160 RED, RST, lang_tag);
161 return 1;
162 }
163
164 int fails = 0;
165
166 /* 7. callable-sourcing -- mod must be 0; we also require >=1 callable-sourced
167 * edge so a fixture that produced zero CALLS edges cannot vacuously pass. */
168 int module_sourced = 0;
169 int callable_sourced = 0;
170 inv_count_calls_by_source(store, lp.project, &module_sourced,
171 &callable_sourced);
172 if (module_sourced != 0) {
173 printf(" %sFAIL%s [%s] callable-sourcing: %d in-body CALLS sourced at "
174 "Module (callable=%d) -- known enclosing-func gap\n",
175 RED, RST, lang_tag, module_sourced, callable_sourced);
176 fails++;
177 } else if (callable_sourced < 1) {
178 printf(" %sFAIL%s [%s] callable-sourcing: 0 CALLS edges (fixture "
179 "produced no in-body call edge to attribute)\n",
180 RED, RST, lang_tag);
181 fails++;
182 }
183
184 /* 8. no-dangling -- every CALLS edge endpoint must resolve. */
185 int dangling = inv_count_dangling_edges(store, lp.project, "CALLS");
186 if (dangling != 0) {
187 printf(" %sFAIL%s [%s] no-dangling: %d dangling CALLS endpoint(s)\n",
188 RED, RST, lang_tag, dangling);
189 fails++;
190 }
191
192 rh_cleanup(&lp, store);
193 return fails ? 1 : 0;
194}
195
196/* -- Haskell ---------------------------------------------------------------
197 * Idiomatic: module header, a helper function, a caller function whose body

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