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

Function create_test_db

tests/test_artifact.c:35–53  ·  view source on GitHub ↗

Create a minimal but valid DB with some nodes and edges. */

Source from the content-addressed store, hash-verified

33
34/* Create a minimal but valid DB with some nodes and edges. */
35static 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
55static void cleanup_dir(const char *path) {
56 char cmd[2048];

Callers 1

test_artifact.cFile · 0.85

Calls 3

cbm_store_open_pathFunction · 0.85
cbm_store_execFunction · 0.85
cbm_store_closeFunction · 0.85

Tested by

no test coverage detected