-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_module.c
34 lines (32 loc) · 1.07 KB
/
test_module.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
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <sys/stat.h>
#include "shared/file.c"
#include "shared/string.c"
#ifdef test_success
#define code 0
#define output "succesful compilation output"
#define config "--TRUE .TRUE"
#define name "DEBUG_OK"
#else
#define code 1
#define output "testing failure behavior"
#define config "--FALSE .FALSE"
#define name "DEBUG_NO"
#endif
int main (int argc, char **argv) {
if (argc == 3) {
file_write(argv[2], output, sizeof(output));
return code;
}
else if (argc == 2) {
if (string_compare(argv[1], "--version", 16)) { printf(name ", version 0.0.0\n"); exit(0); }
if (string_compare(argv[1], "--contributors", 16)) { printf(name ": John Alex, Modula.dev\n"); exit(0); }
if (string_compare(argv[1], "--mconfig", 16)) { printf(name config "\n"); exit(0); }
if (string_compare(argv[1], "--license", 16)) { printf(name ": GNU GPLv3\n"); exit(0); }
}
else { printf("usage: %s input output\n"); exit(1); }
}