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

Function create_test_project

tests/test_integration.c:32–96  ·  view source on GitHub ↗

Create source files in temp directory */

Source from the content-addressed store, hash-verified

30
31/* Create source files in temp directory */
32static int create_test_project(void) {
33 snprintf(g_tmpdir, sizeof(g_tmpdir), "/tmp/cbm_integ_XXXXXX");
34 if (!cbm_mkdtemp(g_tmpdir))
35 return -1;
36
37 char path[512];
38 FILE *f;
39
40 /* Python file with function calls */
41 snprintf(path, sizeof(path), "%s/main.py", g_tmpdir);
42 f = fopen(path, "w");
43 if (!f)
44 return -1;
45 fprintf(f, "def greet(name):\n"
46 " return 'Hello ' + name\n"
47 "\n"
48 "def farewell(name):\n"
49 " return 'Goodbye ' + name\n"
50 "\n"
51 "def main():\n"
52 " msg = greet('World')\n"
53 " msg2 = farewell('World')\n"
54 " print(msg, msg2)\n");
55 fclose(f);
56
57 /* Go file with function calls */
58 snprintf(path, sizeof(path), "%s/utils.go", g_tmpdir);
59 f = fopen(path, "w");
60 if (!f)
61 return -1;
62 fprintf(f, "package utils\n"
63 "\n"
64 "func Add(a, b int) int {\n"
65 " return a + b\n"
66 "}\n"
67 "\n"
68 "func Multiply(a, b int) int {\n"
69 " sum := Add(a, b)\n"
70 " return sum * 2\n"
71 "}\n"
72 "\n"
73 "func Compute(x int) int {\n"
74 " return Multiply(x, Add(x, 1))\n"
75 "}\n");
76 fclose(f);
77
78 /* JavaScript file */
79 snprintf(path, sizeof(path), "%s/app.js", g_tmpdir);
80 f = fopen(path, "w");
81 if (!f)
82 return -1;
83 fprintf(f, "function validate(input) {\n"
84 " return input != null;\n"
85 "}\n"
86 "\n"
87 "function process(data) {\n"
88 " if (validate(data)) {\n"
89 " return data.toUpperCase();\n"

Callers 1

integration_setupFunction · 0.85

Calls 1

cbm_mkdtempFunction · 0.85

Tested by

no test coverage detected