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) */
| 606 | * HandleOrder→LogError (CALLS), main→HandleOrder (DEFINES) |
| 607 | */ |
| 608 | static 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 |
no test coverage detected