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

Function create_tests_edges

src/pipeline/pass_tests.c:212–249  ·  view source on GitHub ↗

Create TESTS edges from test functions to production functions via CALLS edges. */

Source from the content-addressed store, hash-verified

210
211/* Create TESTS edges from test functions to production functions via CALLS edges. */
212static int create_tests_edges(cbm_pipeline_ctx_t *ctx) {
213 int count = 0;
214 const cbm_gbuf_edge_t **call_edges = NULL;
215 int call_count = 0;
216 int rc = cbm_gbuf_find_edges_by_type(ctx->gbuf, "CALLS", &call_edges, &call_count);
217 if (rc != 0 || call_count == 0) {
218 return 0;
219 }
220
221 for (int i = 0; i < call_count; i++) {
222 const cbm_gbuf_edge_t *e = call_edges[i];
223 const cbm_gbuf_node_t *src = cbm_gbuf_find_by_id(ctx->gbuf, e->source_id);
224 const cbm_gbuf_node_t *tgt = cbm_gbuf_find_by_id(ctx->gbuf, e->target_id);
225 if (!src || !tgt) {
226 continue;
227 }
228
229 bool src_is_test =
230 node_is_test(src) || (src->file_path && cbm_is_test_path(src->file_path));
231 if (!src_is_test) {
232 continue;
233 }
234
235 bool tgt_is_test =
236 node_is_test(tgt) || (tgt->file_path && cbm_is_test_path(tgt->file_path));
237 if (tgt_is_test) {
238 continue;
239 }
240
241 if (!cbm_is_test_func_name(src->name)) {
242 continue;
243 }
244
245 cbm_gbuf_insert_edge(ctx->gbuf, src->id, tgt->id, "TESTS", "{}");
246 count++;
247 }
248 return count;
249}
250
251/* Create TESTS_FILE edges from test File nodes to production File nodes. */
252static int create_tests_file_edges(cbm_pipeline_ctx_t *ctx) {

Callers 1

cbm_pipeline_pass_testsFunction · 0.85

Calls 6

cbm_gbuf_find_by_idFunction · 0.85
node_is_testFunction · 0.85
cbm_is_test_pathFunction · 0.85
cbm_is_test_func_nameFunction · 0.85
cbm_gbuf_insert_edgeFunction · 0.85

Tested by

no test coverage detected