-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.c
35 lines (32 loc) · 974 Bytes
/
project.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "cuilt.c"
int test(strlist argv) {
const char* test_c = PATH(config.project.test, "test.c");
const char* test_out = PATH(config.project.test, "test");
CC(LIST(test_c), test_out);
if (CMD(test_out) != 0)
FATAL("build has errors");
else
INFO("test build successful");
strlist files = FILES(config.project.test, ".laps");
size_t passcount = 0;
size_t filecount = 0;
for (; files[filecount] != NULL; filecount++) {
char* outf = reallocat(no_extension(files[filecount]), ".out");
if (TESTF(outf, output, files[filecount]) == 0) {
INFO("test %s passed", files[filecount]);
passcount++;
} else {
ERROR("test %s failed", files[filecount]);
}
};
msg(passcount == filecount ? LOG_INFO : LOG_ERROR, "%d/%d tests passed", passcount, filecount);
return passcount != filecount;
}
CONFIG({
.cc = {
.flags = LIST("-lm", "-Wall", "-Werror", "-std=c23", "-Wno-unused-local-typedefs", "-Wno-varargs"),
},
.process = {
.test = &test,
}
})