summaryrefslogtreecommitdiffstats
path: root/local/tests.h
diff options
context:
space:
mode:
Diffstat (limited to 'local/tests.h')
-rw-r--r--local/tests.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/local/tests.h b/local/tests.h
new file mode 100644
index 0000000..324cc22
--- /dev/null
+++ b/local/tests.h
@@ -0,0 +1,29 @@
+
+#ifndef PROCPS_NG_TESTS_H
+#define PROCPS_NG_TESTS_H
+
+#include <stdio.h>
+
+typedef int (*TestFunction)(void *data);
+
+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;
+}
+#endif