mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 06:46:00 +01:00
Begin document test case
This commit is contained in:
parent
9cdd963784
commit
2340590e93
2 changed files with 45 additions and 15 deletions
24
tests/test_document.c
Normal file
24
tests/test_document.c
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/* 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 <stdlib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
Suite* suite_session();
|
#define LENGTH(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
Suite* suite_utils();
|
|
||||||
|
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
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
|
@ -17,19 +28,14 @@ main(int argc, char* argv[])
|
||||||
/* init gtk */
|
/* init gtk */
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
/* test session */
|
/* run test suites */
|
||||||
suite = suite_session();
|
for (unsigned int i = 0; i < LENGTH(suites); i++) {
|
||||||
suite_runner = srunner_create(suite);
|
suite = suites[i]();
|
||||||
srunner_run_all(suite_runner, CK_NORMAL);
|
suite_runner = srunner_create(suite);
|
||||||
number_failed += srunner_ntests_failed(suite_runner);
|
srunner_run_all(suite_runner, CK_NORMAL);
|
||||||
srunner_free(suite_runner);
|
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);
|
|
||||||
|
|
||||||
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue