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

Function compare_write_fixture_store

tests/test_mcp.c:15321–15404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15319}
15320
15321static bool compare_write_fixture_store(const char *path, const char *project, bool target) {
15322 static const compare_node_spec_t base_nodes[] = {
15323 {"pkg.common", "Function", "src/common.c"}, {"pkg.base", "Function", "src/base.c"},
15324 {"pkg.changed", "Function", "src/old.c"}, {"pkg.source", "Module", "src/source.c"},
15325 {"pkg.sink", "Module", "src/sink.c"},
15326 };
15327 static const compare_node_spec_t target_nodes[] = {
15328 {"pkg.common", "Function", "src/common.c"}, {"pkg.target", "Function", "src/target.c"},
15329 {"pkg.changed", "Method", "src/new.c"}, {"pkg.source", "Module", "src/source.c"},
15330 {"pkg.sink", "Module", "src/sink.c"},
15331 };
15332 static const int base_order[] = {3, 2, 0, 4, 1};
15333 static const int target_order[] = {1, 4, 0, 2, 3};
15334 const compare_node_spec_t *nodes = target ? target_nodes : base_nodes;
15335 const int *order = target ? target_order : base_order;
15336
15337 cbm_store_t *store = cbm_store_open_path(path);
15338 if (!store ||
15339 cbm_store_upsert_project(store, project, "/tmp/compare-graphs-525") != CBM_STORE_OK) {
15340 cbm_store_close(store);
15341 return false;
15342 }
15343 int64_t ids[5] = {0};
15344 bool ok = true;
15345 for (size_t position = 0; position < 5; position++) {
15346 int index = order[position];
15347 cbm_node_t node = {
15348 .project = project,
15349 .label = nodes[index].label,
15350 .name = nodes[index].qualified_name,
15351 .qualified_name = nodes[index].qualified_name,
15352 .file_path = nodes[index].file_path,
15353 .properties_json = "{}",
15354 };
15355 ids[index] = cbm_store_upsert_node(store, &node);
15356 ok = ok && ids[index] > 0;
15357 }
15358
15359 cbm_edge_t common_call = {
15360 .project = project,
15361 .source_id = ids[3],
15362 .target_id = ids[4],
15363 .type = "CALLS",
15364 .properties_json = "{}",
15365 };
15366 cbm_edge_t common_import = {
15367 .project = project,
15368 .source_id = ids[3],
15369 .target_id = ids[4],
15370 .type = "IMPORTS",
15371 .properties_json = "{\"local_name\":\"Alpha\"}",
15372 };
15373 cbm_edge_t changed_import = {
15374 .project = project,
15375 .source_id = ids[3],
15376 .target_id = ids[4],
15377 .type = "IMPORTS",
15378 .properties_json = target ? "{\"local_name\":\"Gamma\"}" : "{\"local_name\":\"Beta\"}",

Callers 1

Calls 7

cbm_store_open_pathFunction · 0.85
cbm_store_upsert_projectFunction · 0.85
cbm_store_closeFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85
cbm_store_insert_edgeFunction · 0.85
compare_write_coverageFunction · 0.85

Tested by

no test coverage detected