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

Function setup_reference_store

tests/test_cypher.c:5592–5627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5590enum { REF_NODES = 400, REF_NAMES = 97 };
5591
5592static cbm_store_t *setup_reference_store(void) {
5593 cbm_store_t *s = cbm_store_open_memory();
5594 cbm_store_upsert_project(s, "test", "/tmp/test");
5595 int64_t ids[REF_NODES];
5596 for (int i = 0; i < REF_NODES; i++) {
5597 char name[32];
5598 char qn[32];
5599 char file[32];
5600 snprintf(name, sizeof(name), "fn_%02d", (i * 7) % REF_NAMES); /* repeated names */
5601 snprintf(qn, sizeof(qn), "test.n%d", i);
5602 snprintf(file, sizeof(file), "f%02d.c", i % 13);
5603 cbm_node_t n = {.project = "test",
5604 .label = "Function",
5605 .name = name,
5606 .qualified_name = qn,
5607 .file_path = file,
5608 .start_line = (i * 31) % 50, /* tied lines */
5609 .end_line = 60};
5610 ids[i] = cbm_store_upsert_node(s, &n);
5611 }
5612 /* Every node calls both hubs (n0, n1: ~400 callers, 97 distinct names,
5613 * past the hashed COUNT(DISTINCT) threshold) and one more node. */
5614 for (int i = 0; i < REF_NODES; i++) {
5615 int targets[3] = {0, 1, (i * i + 3) % REF_NODES};
5616 for (int t = 0; t < 3; t++) {
5617 if (targets[t] != i) {
5618 cbm_edge_t e = {.project = "test",
5619 .source_id = ids[i],
5620 .target_id = ids[targets[t]],
5621 .type = "CALLS"};
5622 cbm_store_insert_edge(s, &e);
5623 }
5624 }
5625 }
5626 return s;
5627}
5628
5629typedef int (*ref_cmp_fn)(const cbm_cypher_result_t *r, int a, int b);
5630

Callers 1

test_cypher.cFile · 0.85

Calls 4

cbm_store_open_memoryFunction · 0.85
cbm_store_upsert_projectFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85
cbm_store_insert_edgeFunction · 0.85

Tested by

no test coverage detected