From 6fd5b4e58bc635def17fb1d3cde0d21ea689a4b0 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 20 Oct 2013 15:37:03 +0200 Subject: [PATCH] t/utils/channel_test: Added a test-case for sdb_channel_select(). --- t/utils/channel_test.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/utils/channel_test.c b/t/utils/channel_test.c index 30fc263..20fd454 100644 --- a/t/utils/channel_test.c +++ b/t/utils/channel_test.c @@ -29,6 +29,7 @@ #include "libsysdb_test.h" #include +#include #include #include @@ -146,6 +147,28 @@ START_TEST(test_write_read) } END_TEST +START_TEST(test_select) +{ + struct timespec ts = { 0, 10 }; + int check; + int data; + + chan = sdb_channel_create(0, 1); + + check = sdb_channel_select(chan, &data, NULL, NULL, NULL, &ts); + fail_unless(check == ETIMEDOUT, + "sdb_channel_select() = %i; expected: %i (ETIMEDOUT)", + check, ETIMEDOUT); + + check = sdb_channel_select(chan, NULL, NULL, &data, NULL, NULL); + fail_unless(! check, "sdb_channel_select() = %i; expected: 0", check); + check = sdb_channel_select(chan, NULL, NULL, &data, NULL, &ts); + fail_unless(! check, "sdb_channel_select() = %i; expected: 0", check); + + sdb_channel_destroy(chan); +} +END_TEST + START_TEST(test_write_int) { size_t i; @@ -320,6 +343,7 @@ util_channel_suite(void) tc = tcase_create("core"); tcase_add_test(tc, test_create); tcase_add_test(tc, test_write_read); + tcase_add_test(tc, test_select); suite_add_tcase(s, tc); tc = tcase_create("integer"); -- 2.30.2