-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathdriver.c
More file actions
49 lines (39 loc) · 1.17 KB
/
driver.c
File metadata and controls
49 lines (39 loc) · 1.17 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
#include <stdio.h>
#include <string.h>
#include "driver.h"
#include "express/memory.h"
#include "express/factory.h"
extern struct test_def tests[];
int main(int argc, char *argv[]) {
int status;
/* enable libexpress allocator */
MEMORYinitialize();
FACTORYinitialize();
argc--;
status = 0;
if (argc) {
int test_counter = argc;
/* selected tests */
for (int i=1; i <= argc; i++) {
for (unsigned int j=0; tests[j].name != NULL; j++) {
const char *test_name = tests[j].name;
int (*test_ptr) (void) = tests[j].testfunc;
if (!strcmp(argv[i], test_name)) {
test_counter--;
setup();
status |= test_ptr();
}
}
}
if (test_counter)
fprintf(stderr, "WARNING: some tests not found...\n");
} else {
/* all tests */
for (unsigned int j=0; tests[j].name != NULL; j++) {
int (*test_ptr) (void) = tests[j].testfunc;
setup();
status |= test_ptr();
}
}
return status;
}