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

Function setup_cypher_store

tests/test_cypher.c:466–513  ·  view source on GitHub ↗

Helper: set up the standard test graph. * Nodes: HandleOrder, ValidateOrder, SubmitOrder (Function), main (Module), LogError (Function) * Edges: HandleOrder→ValidateOrder (CALLS), ValidateOrder→SubmitOrder (CALLS), * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES) */

Source from the content-addressed store, hash-verified

464 * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES)
465 */
466static cbm_store_t *setup_cypher_store(void) {
467 cbm_store_t *s = cbm_store_open_memory();
468 cbm_store_upsert_project(s, "test", "/tmp/test");
469
470 cbm_node_t n1 = {.project = "test",
471 .label = "Function",
472 .name = "HandleOrder",
473 .qualified_name = "test.HandleOrder",
474 .file_path = "handler.go",
475 .start_line = 10,
476 .end_line = 30};
477 cbm_node_t n2 = {.project = "test",
478 .label = "Function",
479 .name = "ValidateOrder",
480 .qualified_name = "test.ValidateOrder",
481 .file_path = "validate.go",
482 .start_line = 5,
483 .end_line = 15};
484 cbm_node_t n3 = {.project = "test",
485 .label = "Function",
486 .name = "SubmitOrder",
487 .qualified_name = "test.SubmitOrder",
488 .file_path = "submit.go"};
489 cbm_node_t n4 = {
490 .project = "test", .label = "Module", .name = "main", .qualified_name = "test.main"};
491 cbm_node_t n5 = {.project = "test",
492 .label = "Function",
493 .name = "LogError",
494 .qualified_name = "test.LogError",
495 .file_path = "log.go"};
496
497 int64_t id1 = cbm_store_upsert_node(s, &n1);
498 int64_t id2 = cbm_store_upsert_node(s, &n2);
499 int64_t id3 = cbm_store_upsert_node(s, &n3);
500 int64_t id4 = cbm_store_upsert_node(s, &n4);
501 int64_t id5 = cbm_store_upsert_node(s, &n5);
502
503 cbm_edge_t e1 = {.project = "test", .source_id = id1, .target_id = id2, .type = "CALLS"};
504 cbm_edge_t e2 = {.project = "test", .source_id = id2, .target_id = id3, .type = "CALLS"};
505 cbm_edge_t e3 = {.project = "test", .source_id = id1, .target_id = id5, .type = "CALLS"};
506 cbm_edge_t e4 = {.project = "test", .source_id = id4, .target_id = id1, .type = "DEFINES"};
507 cbm_store_insert_edge(s, &e1);
508 cbm_store_insert_edge(s, &e2);
509 cbm_store_insert_edge(s, &e3);
510 cbm_store_insert_edge(s, &e4);
511
512 return s;
513}
514
515/* The query string is caller-supplied and the WHERE grammar recurses once per
516 * nested '(' and once per NOT, with no depth counter between the MCP entry point

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