/* * Test Reply Tracking */ #undef NDEBUG #include #include #include #include #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; }