From 0a0c712e17e7886c0412279feb4793d63f0b2617 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Mon, 19 Mar 2012 17:00:34 +0100 Subject: [PATCH] Added basic session test --- main.c | 1 - tests/test_session.c | 24 ++++++++++++++++++++++++ tests/tests.c | 14 +++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 tests/test_session.c diff --git a/main.c b/main.c index f24bef8..7c80083 100644 --- a/main.c +++ b/main.c @@ -33,4 +33,3 @@ int main(int argc, char* argv[]) return 0; } - diff --git a/tests/test_session.c b/tests/test_session.c new file mode 100644 index 0000000..5e1b398 --- /dev/null +++ b/tests/test_session.c @@ -0,0 +1,24 @@ +/* See LICENSE file for license and copyright information */ + +#include + +#include "../zathura.h" + +START_TEST(test_create) { + zathura_t* zathura = zathura_init(0, NULL); + fail_unless(zathura != NULL, "Could not create session"); + zathura_free(zathura); +} END_TEST + +Suite* suite_session() +{ + TCase* tcase = NULL; + Suite* suite = suite_create("Session"); + + /* basic */ + tcase = tcase_create("basic"); + tcase_add_test(tcase, test_create); + suite_add_tcase(suite, tcase); + + return suite; +} diff --git a/tests/tests.c b/tests/tests.c index 03a1242..3357835 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -3,14 +3,26 @@ #include #include +Suite* suite_session(); Suite* suite_utils(); -int main() +int +main(int argc, char* argv[]) { Suite* suite = NULL; SRunner* suite_runner = NULL; int number_failed = 0; + /* 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);