diff --git a/test/check.c b/test/check.c new file mode 100644 --- /dev/null +++ b/test/check.c @@ -0,0 +1,66 @@ +/* + * Copyright 2010 Nathan Phillip Brink + * + * This file is a part of DistRen. + * + * DistRen is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DistRen is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with DistRen. If not, see . + */ + +#include +#include +#include + +#include "check_asprintf.h" +#include "check_csv.h" +#include "check_execio.h" + +/** + * \brief + * Use libcheck to run our full testsuite. + */ +int main(int argc, char *argv[]) +{ + int number_failed; + size_t test_num; + + Suite *s; + SRunner *sr; + + Suite *(*suites[])() = + { + &asprintf_suite, + &csv_suite, + &execio_suite, + NULL + }; + + number_failed = 0; + + for (test_num = 0; suites[test_num]; test_num ++) + { + s = (*suites[test_num])(); + sr = srunner_create(s); + + srunner_run_all(sr, CK_NORMAL); + number_failed += srunner_ntests_failed(sr); + srunner_free(sr); + } + + if (number_failed) + { + fprintf(stderr, "total tests failed: %d\n", number_failed); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +}