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

Function create_test_db

tests/test_artifact.c:41–59  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

39
40/* Create a minimal but valid DB with some nodes and edges. */
41static void create_test_db(const char *path) {
42 cbm_store_t *s = cbm_store_open_path(path);
43 if (!s) {
44 return;
45 }
46
47 cbm_store_exec(s, "INSERT OR IGNORE INTO projects(name, indexed_at, root_path) "
48 "VALUES('test-proj', '2026-01-01', '/tmp/test');");
49
50 cbm_store_exec(s, "INSERT INTO nodes(project, label, name, qualified_name, file_path) "
51 "VALUES('test-proj', 'Function', 'foo', 'test-proj.foo', 'main.c');");
52 cbm_store_exec(s, "INSERT INTO nodes(project, label, name, qualified_name, file_path) "
53 "VALUES('test-proj', 'Function', 'bar', 'test-proj.bar', 'main.c');");
54
55 cbm_store_exec(s, "INSERT INTO edges(project, source_id, target_id, type) "
56 "VALUES('test-proj', 1, 2, 'CALLS');");
57
58 cbm_store_close(s);
59}
60
61static void cleanup_dir(const char *path) {
62 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