/
githubmirror
/
dbus-broker
Обзор
Документация
Войти
/
githubmirror
/
dbus-broker
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v21
src/util/test-dirwatch.c
48 строк
1 KB
David Rheinsberg
dbus-broker: switch test infrastructure to c_assert()
10 апр 2019, 13:23
10 апр 2019, 13:23
47562f3
Код
Авторство
О чём код?
/* * Test Directory Watch */ #undef NDEBUG #include <c-stdaux.h> #include <stdlib.h> #include "util/dirwatch.h" static void test_basic(void) { int r, fd; /* test cleanup helper */ { _c_cleanup_(dirwatch_freep) Dirwatch *dw1 = NULL, *dw2 = NULL; /* prevent 'unused variable' warning */ dw1 = NULL; r = dirwatch_new(&dw2); c_assert(!r); } /* test no-op dispatcher */ { _c_cleanup_(dirwatch_freep) Dirwatch *dw = NULL; r = dirwatch_new(&dw); c_assert(!r); fd = dirwatch_get_fd(dw); c_assert(fd >= 0); r = dirwatch_dispatch(dw); c_assert(!r); r = dirwatch_add(dw, "."); c_assert(!r); r = dirwatch_dispatch(dw); c_assert(!r); } } int main(int argc, char **argv) { test_basic(); return 0; }