2016-04-14 17:58:38 +05:30
|
|
|
|
|
|
|
#ifndef PROCPS_NG_TESTS_H
|
|
|
|
#define PROCPS_NG_TESTS_H
|
|
|
|
|
2020-08-15 21:41:11 +05:30
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-04-19 17:03:02 +05:30
|
|
|
typedef int (*TestFunction)(void *data);
|
2016-04-14 17:58:38 +05:30
|
|
|
|
2016-04-19 17:03:02 +05:30
|
|
|
char *testname;
|
|
|
|
|
|
|
|
|
|
|
|
static inline int run_tests(TestFunction *list, void *data)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
TestFunction current;
|
|
|
|
|
|
|
|
for (i=0; list[i] != NULL; i++) {
|
|
|
|
testname = NULL;
|
|
|
|
current = list[i];
|
|
|
|
if (!current(data)) {
|
|
|
|
fprintf(stderr, "FAIL: %s\n", testname);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "PASS: %s\n", testname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
2016-04-14 17:58:38 +05:30
|
|
|
#endif
|