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

Function setup_cypher_store

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

529 * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES)
530 */
531static cbm_store_t *setup_cypher_store(void) {
532 cbm_store_t *s = cbm_store_open_memory();
533 cbm_store_upsert_project(s, "test", "/tmp/test");
534
535 cbm_node_t n1 = {.project = "test",
536 .label = "Function",
537 .name = "HandleOrder",
538 .qualified_name = "test.HandleOrder",
539 .file_path = "handler.go",
540 .start_line = 10,
541 .end_line = 30};
542 cbm_node_t n2 = {.project = "test",
543 .label = "Function",
544 .name = "ValidateOrder",
545 .qualified_name = "test.ValidateOrder",
546 .file_path = "validate.go",
547 .start_line = 5,
548 .end_line = 15};
549 cbm_node_t n3 = {.project = "test",
550 .label = "Function",
551 .name = "SubmitOrder",
552 .qualified_name = "test.SubmitOrder",
553 .file_path = "submit.go"};
554 cbm_node_t n4 = {
555 .project = "test", .label = "Module", .name = "main", .qualified_name = "test.main"};
556 cbm_node_t n5 = {.project = "test",
557 .label = "Function",
558 .name = "LogError",
559 .qualified_name = "test.LogError",
560 .file_path = "log.go"};
561
562 int64_t id1 = cbm_store_upsert_node(s, &n1);
563 int64_t id2 = cbm_store_upsert_node(s, &n2);
564 int64_t id3 = cbm_store_upsert_node(s, &n3);
565 int64_t id4 = cbm_store_upsert_node(s, &n4);
566 int64_t id5 = cbm_store_upsert_node(s, &n5);
567
568 cbm_edge_t e1 = {.project = "test", .source_id = id1, .target_id = id2, .type = "CALLS"};
569 cbm_edge_t e2 = {.project = "test", .source_id = id2, .target_id = id3, .type = "CALLS"};
570 cbm_edge_t e3 = {.project = "test", .source_id = id1, .target_id = id5, .type = "CALLS"};
571 cbm_edge_t e4 = {.project = "test", .source_id = id4, .target_id = id1, .type = "DEFINES"};
572 cbm_store_insert_edge(s, &e1);
573 cbm_store_insert_edge(s, &e2);
574 cbm_store_insert_edge(s, &e3);
575 cbm_store_insert_edge(s, &e4);
576
577 return s;
578}
579
580/* The query string is caller-supplied and the WHERE grammar recurses once per
581 * 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