diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-11 11:14:40 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-06-11 11:14:40 +0100 |
commit | 43f7f54dadecb1d11b4fd9cd2af4889043865490 (patch) | |
tree | af12882b778ed23ceac476ae8aba645701046815 /test/testmain.c | |
parent | 8b4ce0ba86d0396bde2546dd248c863876da4106 (diff) | |
download | libnslog-43f7f54dadecb1d11b4fd9cd2af4889043865490.tar.gz libnslog-43f7f54dadecb1d11b4fd9cd2af4889043865490.tar.bz2 |
Switch to a check based test suite, start fixing bugs
Diffstat (limited to 'test/testmain.c')
-rw-r--r-- | test/testmain.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/testmain.c b/test/testmain.c new file mode 100644 index 0000000..9a6b257 --- /dev/null +++ b/test/testmain.c @@ -0,0 +1,50 @@ +/* test/testmain.c + * + * Core of the test suite for libnslog + * + * Copyright 2009, 2017 The NetSurf Browser Project + * Daniel Silverstone <dsilvers@netsurf-browser.org> + */ + +#include <check.h> +#include <stdlib.h> + +#include "tests.h" + +#ifndef UNUSED +#define UNUSED(x) ((x) = (x)) +#endif + +/* This means that assertion failures are silent in tests */ +#ifndef NDEBUG +void __assert_fail(const char *__assertion, const char *__file, + unsigned int __line, const char *__function) { + (void)__assertion; + (void)__file; + (void)__line; + (void)__function; + abort(); +} +#endif + +int +main(int argc, char **argv) +{ + int number_failed = 0; + SRunner *sr; + + UNUSED(argc); + UNUSED(argv); + + sr = srunner_create(suite_create("Test suite for libnslog")); + + nslog_basic_suite(sr); + + srunner_set_fork_status(sr, CK_FORK); + srunner_run_all(sr, CK_ENV); + number_failed = srunner_ntests_failed(sr); + + srunner_free(sr); + + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} |