-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_main.c
More file actions
51 lines (46 loc) · 1.04 KB
/
test_main.c
File metadata and controls
51 lines (46 loc) · 1.04 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
CS3500 - Software Engineering Project
Main file that runs all the other unittests together
Colin Kelleher
Jonathan Hanley
Karol Przestrzelski
Liam de la Cour
*/
/*
Include statements
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
listing all the test files below
*/
char *files[] = {
"test_codegenerator.t",
"test_common.t",
"test_infixtopostfix.t",
"test_stack.t",
"test_tokenizer.t",
"test_virtualmachine.t",
"test_tokenizer_infixtopostfix.t",
"test_infixtopostfix_codegenerator.t",
"test_system.t"
};
/*
Checking if the files exist and then executing them
according to terminal commands
*/
int main(){
char cmd[300] = "prove";
for (int i=0; i<sizeof(files)/sizeof(files[0]); i++){
// Check if this file exists
FILE *f;
f = fopen(files[i], "r");
printf("%s\n", files[i]);
if (f == NULL) continue;
// Execute ./test_file
printf("Found tests for %s\n", files[i]);
sprintf(cmd, "%s ./%s", cmd, files[i]);
}
system(cmd);
}