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

Function imp_write_hot_fixture

tests/test_importance.c:177–193  ·  view source on GitHub ↗

Write a fixture whose `helper` in hot.py is called from `callers` other * files — the inbound edges that only exist project-wide, never in a delta * buffer. `tag` lets the caller perturb hot.py to force a re-parse. */

Source from the content-addressed store, hash-verified

175 * files — the inbound edges that only exist project-wide, never in a delta
176 * buffer. `tag` lets the caller perturb hot.py to force a re-parse. */
177static int imp_write_hot_fixture(const char *root, int callers, const char *tag) {
178 char body[256];
179 snprintf(body, sizeof(body), "%sdef helper():\n return 1\n", tag);
180 if (th_write_file(TH_PATH(root, "hot.py"), body) != 0) {
181 return -1;
182 }
183 for (int i = 0; i < callers; i++) {
184 char rel[64];
185 char src[192];
186 snprintf(rel, sizeof(rel), "c%d.py", i);
187 snprintf(src, sizeof(src), "import hot\n\ndef use%d():\n return hot.helper()\n", i);
188 if (th_write_file(TH_PATH(root, rel), src) != 0) {
189 return -1;
190 }
191 }
192 return 0;
193}
194
195/* ── Registration: the pass must actually execute ─────────────────────── */
196

Callers 1

test_importance.cFile · 0.85

Calls 1

th_write_fileFunction · 0.85

Tested by

no test coverage detected