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

Function create_test_project

tests/test_integration.c:33–97  ·  view source on GitHub ↗

Create source files in temp directory */

Source from the content-addressed store, hash-verified

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

Callers 1

integration_setupFunction · 0.85

Calls 1

cbm_mkdtempFunction · 0.85

Tested by

no test coverage detected