Commit 2340590e authored by Moritz Lipp's avatar Moritz Lipp

Begin document test case

parent 9cdd9637
/* See LICENSE file for license and copyright information */
#include <check.h>
#include "../document.h"
START_TEST(test_open) {
fail_unless(zathura_document_open(NULL, NULL, NULL) == NULL, "Could create document", NULL);
fail_unless(zathura_document_open(NULL, "fl", NULL) == NULL, "Could create document", NULL);
fail_unless(zathura_document_open(NULL, "fl", "pw") == NULL, "Could create document", NULL);
} END_TEST
Suite* suite_document()
{
TCase* tcase = NULL;
Suite* suite = suite_create("Document");
/* basic */
tcase = tcase_create("basic");
tcase_add_test(tcase, test_open);
suite_add_tcase(suite, tcase);
return suite;
}
......@@ -4,8 +4,19 @@
#include <stdlib.h>
#include <gtk/gtk.h>
Suite* suite_session();
Suite* suite_utils();
#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,
};
int
main(int argc, char* argv[])
......@@ -17,19 +28,14 @@ main(int argc, char* argv[])
/* init gtk */
gtk_init(&argc, &argv);
/* test session */
suite = suite_session();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test utils */
suite = suite_utils();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* 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);
}
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment