aboutsummaryrefslogtreecommitdiffstats
path: root/test/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.c')
-rw-r--r--test/main.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/main.c b/test/main.c
index c8fae63..6d7d8bf 100644
--- a/test/main.c
+++ b/test/main.c
@@ -21,18 +21,27 @@
#include "test.h"
#include "float_test.h"
#include "diagnostic_test.h"
+#include "gpio_test.h"
/* TODO: allow individual tests to be selected */
-
int main(int argc, char **argv)
{
- struct test_results res;
+ static const struct section sections[] = {
+ {"float", float_test},
+ {"diagnostic", diagnostic_test},
+ {"gpio", gpio_test} };
+ size_t i;
- res = float_test();
- res = diagnostic_test();
+ if (argc != 3) {
+ return EXIT_FAILURE;
+ }
- printf("%u tests executed, %u test succeeded, %u tests failed.\n", res.executed, res.executed - res.failed, res.failed);
+ for (i = 0; i < arrlen(sections); ++i) {
+ if (!strcmp(argv[1], sections[i].name)) {
+ return sections[i].testfunc(argv[2]);
+ }
+ }
- return EXIT_SUCCESS;
+ return EXIT_FAILURE;
}