Create a minimal but valid DB with some nodes and edges. */
| 33 | |
| 34 | /* Create a minimal but valid DB with some nodes and edges. */ |
| 35 | static void create_test_db(const char *path) { |
| 36 | cbm_store_t *s = cbm_store_open_path(path); |
| 37 | if (!s) { |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | cbm_store_exec(s, "INSERT OR IGNORE INTO projects(name, indexed_at, root_path) " |
| 42 | "VALUES('test-proj', '2026-01-01', '/tmp/test');"); |
| 43 | |
| 44 | cbm_store_exec(s, "INSERT INTO nodes(project, label, name, qualified_name, file_path) " |
| 45 | "VALUES('test-proj', 'Function', 'foo', 'test-proj.foo', 'main.c');"); |
| 46 | cbm_store_exec(s, "INSERT INTO nodes(project, label, name, qualified_name, file_path) " |
| 47 | "VALUES('test-proj', 'Function', 'bar', 'test-proj.bar', 'main.c');"); |
| 48 | |
| 49 | cbm_store_exec(s, "INSERT INTO edges(project, source_id, target_id, type) " |
| 50 | "VALUES('test-proj', 1, 2, 'CALLS');"); |
| 51 | |
| 52 | cbm_store_close(s); |
| 53 | } |
| 54 | |
| 55 | static void cleanup_dir(const char *path) { |
| 56 | char cmd[2048]; |
no test coverage detected