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

Function agent_fixture

tests/test_agent_clients.c:61–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static char *agent_fixture(const char *initial, char **dir_out) {
62 char *dir = th_mktempdir("cbm_agent_clients");
63 if (!dir) {
64 return NULL;
65 }
66 size_t length = strlen(dir) + strlen("/config.json") + 1U;
67 char *path = (char *)malloc(length);
68 if (!path) {
69 th_cleanup(dir);
70 return NULL;
71 }
72 snprintf(path, length, "%s/config.json", dir);
73 if (initial && th_write_file(path, initial) != 0) {
74 free(path);
75 th_cleanup(dir);
76 return NULL;
77 }
78 *dir_out = dir;
79 return path;
80}
81
82static char *agent_read(const char *path) {
83 FILE *fp = fopen(path, "rb");

Callers 1

Calls 3

th_mktempdirFunction · 0.85
th_cleanupFunction · 0.85
th_write_fileFunction · 0.85

Tested by

no test coverage detected