diff options
author | 2017-11-08 14:46:54 +0200 | |
---|---|---|
committer | 2017-11-08 14:46:54 +0200 | |
commit | c7198103b9816ef761ddbdf5d23f94e52afdc730 (patch) | |
tree | 06e1cdd5355000e3b828babba43ea3be8d973262 /test/main.c | |
parent | 02096520941201b3a90d3892eadf6846e8e1c5df (diff) | |
download | librin-c7198103b9816ef761ddbdf5d23f94e52afdc730.tar.gz librin-c7198103b9816ef761ddbdf5d23f94e52afdc730.tar.bz2 librin-c7198103b9816ef761ddbdf5d23f94e52afdc730.zip |
tests: split test and let meson handle them.
Diffstat (limited to 'test/main.c')
-rw-r--r-- | test/main.c | 21 |
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; } |