int stun_sock_test(void) { struct pjlib_state pjlib_state; pj_stun_config stun_cfg; pj_ioqueue_t *ioqueue = NULL; pj_timer_heap_t *timer_heap = NULL; pj_pool_t *pool = NULL; pj_status_t status; int ret = 0; pool = pj_pool_create(mem, NULL, 512, 512, NULL); status = pj_ioqueue_create(pool, 12, &ioqueue); if (status != PJ_SUCCESS) { app_perror(" pj_ioqueue_create()", status); ret = -4; goto on_return; } status = pj_timer_heap_create(pool, 100, &timer_heap); if (status != PJ_SUCCESS) { app_perror(" pj_timer_heap_create()", status); ret = -8; goto on_return; } pj_stun_config_init(&stun_cfg, mem, 0, ioqueue, timer_heap); DO_TEST(timeout_test(&stun_cfg, PJ_FALSE)); DO_TEST(timeout_test(&stun_cfg, PJ_TRUE)); DO_TEST(missing_attr_test(&stun_cfg, PJ_FALSE)); DO_TEST(missing_attr_test(&stun_cfg, PJ_TRUE)); DO_TEST(keep_alive_test(&stun_cfg)); on_return: if (timer_heap) pj_timer_heap_destroy(timer_heap); if (ioqueue) pj_ioqueue_destroy(ioqueue); if (pool) pj_pool_release(pool); return ret; }
int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Message_Queue_Test")); int status = 0; # if defined (ACE_HAS_THREADS) if (!timeout_test ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("test failed"))); status = 1; } # endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; }