| 5590 | enum { REF_NODES = 400, REF_NAMES = 97 }; |
| 5591 | |
| 5592 | static cbm_store_t *setup_reference_store(void) { |
| 5593 | cbm_store_t *s = cbm_store_open_memory(); |
| 5594 | cbm_store_upsert_project(s, "test", "/tmp/test"); |
| 5595 | int64_t ids[REF_NODES]; |
| 5596 | for (int i = 0; i < REF_NODES; i++) { |
| 5597 | char name[32]; |
| 5598 | char qn[32]; |
| 5599 | char file[32]; |
| 5600 | snprintf(name, sizeof(name), "fn_%02d", (i * 7) % REF_NAMES); /* repeated names */ |
| 5601 | snprintf(qn, sizeof(qn), "test.n%d", i); |
| 5602 | snprintf(file, sizeof(file), "f%02d.c", i % 13); |
| 5603 | cbm_node_t n = {.project = "test", |
| 5604 | .label = "Function", |
| 5605 | .name = name, |
| 5606 | .qualified_name = qn, |
| 5607 | .file_path = file, |
| 5608 | .start_line = (i * 31) % 50, /* tied lines */ |
| 5609 | .end_line = 60}; |
| 5610 | ids[i] = cbm_store_upsert_node(s, &n); |
| 5611 | } |
| 5612 | /* Every node calls both hubs (n0, n1: ~400 callers, 97 distinct names, |
| 5613 | * past the hashed COUNT(DISTINCT) threshold) and one more node. */ |
| 5614 | for (int i = 0; i < REF_NODES; i++) { |
| 5615 | int targets[3] = {0, 1, (i * i + 3) % REF_NODES}; |
| 5616 | for (int t = 0; t < 3; t++) { |
| 5617 | if (targets[t] != i) { |
| 5618 | cbm_edge_t e = {.project = "test", |
| 5619 | .source_id = ids[i], |
| 5620 | .target_id = ids[targets[t]], |
| 5621 | .type = "CALLS"}; |
| 5622 | cbm_store_insert_edge(s, &e); |
| 5623 | } |
| 5624 | } |
| 5625 | } |
| 5626 | return s; |
| 5627 | } |
| 5628 | |
| 5629 | typedef int (*ref_cmp_fn)(const cbm_cypher_result_t *r, int a, int b); |
| 5630 |
no test coverage detected