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

Function setup_cypher_store

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

427 * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES)
428 */
429static cbm_store_t *setup_cypher_store(void) {
430 cbm_store_t *s = cbm_store_open_memory();
431 cbm_store_upsert_project(s, "test", "/tmp/test");
432
433 cbm_node_t n1 = {.project = "test",
434 .label = "Function",
435 .name = "HandleOrder",
436 .qualified_name = "test.HandleOrder",
437 .file_path = "handler.go",
438 .start_line = 10,
439 .end_line = 30};
440 cbm_node_t n2 = {.project = "test",
441 .label = "Function",
442 .name = "ValidateOrder",
443 .qualified_name = "test.ValidateOrder",
444 .file_path = "validate.go",
445 .start_line = 5,
446 .end_line = 15};
447 cbm_node_t n3 = {.project = "test",
448 .label = "Function",
449 .name = "SubmitOrder",
450 .qualified_name = "test.SubmitOrder",
451 .file_path = "submit.go"};
452 cbm_node_t n4 = {
453 .project = "test", .label = "Module", .name = "main", .qualified_name = "test.main"};
454 cbm_node_t n5 = {.project = "test",
455 .label = "Function",
456 .name = "LogError",
457 .qualified_name = "test.LogError",
458 .file_path = "log.go"};
459
460 int64_t id1 = cbm_store_upsert_node(s, &n1);
461 int64_t id2 = cbm_store_upsert_node(s, &n2);
462 int64_t id3 = cbm_store_upsert_node(s, &n3);
463 int64_t id4 = cbm_store_upsert_node(s, &n4);
464 int64_t id5 = cbm_store_upsert_node(s, &n5);
465
466 cbm_edge_t e1 = {.project = "test", .source_id = id1, .target_id = id2, .type = "CALLS"};
467 cbm_edge_t e2 = {.project = "test", .source_id = id2, .target_id = id3, .type = "CALLS"};
468 cbm_edge_t e3 = {.project = "test", .source_id = id1, .target_id = id5, .type = "CALLS"};
469 cbm_edge_t e4 = {.project = "test", .source_id = id4, .target_id = id1, .type = "DEFINES"};
470 cbm_store_insert_edge(s, &e1);
471 cbm_store_insert_edge(s, &e2);
472 cbm_store_insert_edge(s, &e3);
473 cbm_store_insert_edge(s, &e4);
474
475 return s;
476}
477
478TEST(cypher_exec_match_all_functions) {
479 cbm_store_t *s = setup_cypher_store();

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