/
githubmirror
/
dbus-broker
Обзор
Документация
Войти
/
githubmirror
/
dbus-broker
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v21
src/bus/test-reply.c
45 строк
1 KB
David Rheinsberg
dbus-broker: switch test infrastructure to c_assert()
10 апр 2019, 13:23
10 апр 2019, 13:23
47562f3
Код
Авторство
О чём код?
/* * Test Reply Tracking */ #undef NDEBUG #include <c-stdaux.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include "bus/reply.h" static void test_basic(void) { ReplyRegistry registry; ReplyOwner owner; ReplySlot *slot1, *slot2; int r; reply_registry_init(®istry); reply_owner_init(&owner); r = reply_slot_new(&slot1, ®istry, &owner, NULL, NULL, 1, 1); c_assert(!r); r = reply_slot_new(&slot1, ®istry, &owner, NULL, NULL, 1, 1); c_assert(r == REPLY_E_EXISTS); slot2 = reply_slot_get_by_id(®istry, 1, 1); c_assert(slot2 == slot1); slot2 = reply_slot_get_by_id(®istry, 1, 2); c_assert(!slot2); slot2 = reply_slot_get_by_id(®istry, 2, 1); c_assert(!slot2); reply_slot_free(slot1); reply_owner_deinit(&owner); reply_registry_deinit(®istry); } int main(int argc, char **argv) { test_basic(); return 0; }