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

Function setup_cypher_store

tests/test_cypher.c:608–655  ·  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

606 * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES)
607 */
608static cbm_store_t *setup_cypher_store(void) {
609 cbm_store_t *s = cbm_store_open_memory();
610 cbm_store_upsert_project(s, "test", "/tmp/test");
611
612 cbm_node_t n1 = {.project = "test",
613 .label = "Function",
614 .name = "HandleOrder",
615 .qualified_name = "test.HandleOrder",
616 .file_path = "handler.go",
617 .start_line = 10,
618 .end_line = 30};
619 cbm_node_t n2 = {.project = "test",
620 .label = "Function",
621 .name = "ValidateOrder",
622 .qualified_name = "test.ValidateOrder",
623 .file_path = "validate.go",
624 .start_line = 5,
625 .end_line = 15};
626 cbm_node_t n3 = {.project = "test",
627 .label = "Function",
628 .name = "SubmitOrder",
629 .qualified_name = "test.SubmitOrder",
630 .file_path = "submit.go"};
631 cbm_node_t n4 = {
632 .project = "test", .label = "Module", .name = "main", .qualified_name = "test.main"};
633 cbm_node_t n5 = {.project = "test",
634 .label = "Function",
635 .name = "LogError",
636 .qualified_name = "test.LogError",
637 .file_path = "log.go"};
638
639 int64_t id1 = cbm_store_upsert_node(s, &n1);
640 int64_t id2 = cbm_store_upsert_node(s, &n2);
641 int64_t id3 = cbm_store_upsert_node(s, &n3);
642 int64_t id4 = cbm_store_upsert_node(s, &n4);
643 int64_t id5 = cbm_store_upsert_node(s, &n5);
644
645 cbm_edge_t e1 = {.project = "test", .source_id = id1, .target_id = id2, .type = "CALLS"};
646 cbm_edge_t e2 = {.project = "test", .source_id = id2, .target_id = id3, .type = "CALLS"};
647 cbm_edge_t e3 = {.project = "test", .source_id = id1, .target_id = id5, .type = "CALLS"};
648 cbm_edge_t e4 = {.project = "test", .source_id = id4, .target_id = id1, .type = "DEFINES"};
649 cbm_store_insert_edge(s, &e1);
650 cbm_store_insert_edge(s, &e2);
651 cbm_store_insert_edge(s, &e3);
652 cbm_store_insert_edge(s, &e4);
653
654 return s;
655}
656
657/* The query string is caller-supplied and the WHERE grammar recurses once per
658 * nested '(' and once per NOT, with no depth counter between the MCP entry point

Callers 4

test_cypher.cFile · 0.85
setup_issue2208_storeFunction · 0.85
chain_checkFunction · 0.85
union_many_checkFunction · 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