| 1 |
|
| 2 |
#ifndef PROCPS_NG_TESTS_H |
| 3 |
#define PROCPS_NG_TESTS_H |
| 4 |
|
| 5 |
#include <stdio.h> |
| 6 |
|
| 7 |
typedef int (*TestFunction)(void *data); |
| 8 |
|
| 9 |
char *testname; |
| 10 |
|
| 11 |
|
| 12 |
static inline int run_tests(TestFunction *list, void *data) |
| 13 |
{ |
| 14 |
int i; |
| 15 |
TestFunction current; |
| 16 |
|
| 17 |
for (i=0; list[i] != NULL; i++) { |
| 18 |
testname = NULL; |
| 19 |
current = list[i]; |
| 20 |
if (!current(data)) { |
| 21 |
fprintf(stderr, "FAIL: %s\n", testname); |
| 22 |
return EXIT_FAILURE; |
| 23 |
} else { |
| 24 |
fprintf(stderr, "PASS: %s\n", testname); |
| 25 |
} |
| 26 |
} |
| 27 |
return EXIT_SUCCESS; |
| 28 |
} |
| 29 |
#endif |