zathura/tests/tests.c

42 lines
917 B
C
Raw Normal View History

2012-01-28 19:54:10 +01:00
/* See LICENSE file for license and copyright information */
#include <check.h>
#include <stdlib.h>
2012-03-19 20:09:11 +01:00
#include <gtk/gtk.h>
2012-01-28 19:54:10 +01:00
2012-03-30 16:43:00 +02:00
#define LENGTH(x) (sizeof(x)/sizeof((x)[0]))
extern Suite* suite_session();
extern Suite* suite_utils();
extern Suite* suite_document();
typedef Suite* (*suite_create_fnt_t)(void);
const suite_create_fnt_t suites[] = {
suite_utils,
suite_document,
suite_session,
};
2012-01-28 19:54:10 +01:00
2012-03-19 17:00:34 +01:00
int
main(int argc, char* argv[])
2012-01-28 19:54:10 +01:00
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
2012-01-28 19:54:10 +01:00
2012-03-19 17:00:34 +01:00
/* init gtk */
gtk_init(&argc, &argv);
2012-03-30 16:43:00 +02:00
/* run test suites */
for (unsigned int i = 0; i < LENGTH(suites); i++) {
suite = suites[i]();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
}
2012-01-28 19:54:10 +01:00
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
2012-01-28 19:54:10 +01:00
}