From c8f4c755c3df8f8a9a304a55036baa9ea20cf943 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Tue, 8 Dec 2015 16:36:26 +0000 Subject: Add testing infrastructure --- test/navigator.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/navigator.c (limited to 'test') diff --git a/test/navigator.c b/test/navigator.c new file mode 100644 index 0000000..66f3a43 --- /dev/null +++ b/test/navigator.c @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +#include "navigator.h" + +static void test_navigator_add(void **state) +{ + (void)state; + struct imv_navigator nav; + imv_navigator_init(&nav); + + assert_false(imv_navigator_poll_changed(&nav)); + imv_navigator_add(&nav, "path/to/some/file", 0); + assert_true(imv_navigator_poll_changed(&nav)); + assert_string_equal(imv_navigator_selection(&nav), "path/to/some/file"); + + imv_navigator_destroy(&nav); +} + +int main(void) +{ + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_navigator_add), + }; + + return cmocka_run_group_tests(tests, NULL, NULL); +} -- cgit v1.2.3