|
|
|
|
@ -17,10 +17,30 @@
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
|
|
#include "array_list.h"
|
|
|
|
|
|
|
|
|
|
static void test_cleanup(int *i) {
|
|
|
|
|
printf("cleanup %d\n", *i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEF_ARRAY_LIST_TYPE(test, int, 0, test_cleanup)
|
|
|
|
|
|
|
|
|
|
static int al_test(void) {
|
|
|
|
|
SCOPED(array_list_test, struct array_list, al);
|
|
|
|
|
|
|
|
|
|
if (array_list_test_alloc(&al, 16))
|
|
|
|
|
return 1;
|
|
|
|
|
array_list_test_push_noalloc_byval(&al, 2);
|
|
|
|
|
array_list_test_push_noalloc_byval(&al, 4);
|
|
|
|
|
array_list_test_push_noalloc_byval(&al, 6);
|
|
|
|
|
array_list_test_push_noalloc_byval(&al, 8);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int ev_test(void) {
|
|
|
|
|
struct owd_event timer, pipe_ev;
|
|
|
|
|
struct owd_eventloop el;
|
|
|
|
|
EVENTLOOP_STACK_SCOPED(el_ptr);
|
|
|
|
|
EVENTLOOP_STACK_SCOPED(el);
|
|
|
|
|
owd_event_id_t id;
|
|
|
|
|
uint32_t flags;
|
|
|
|
|
|
|
|
|
|
@ -41,7 +61,6 @@ static int ev_test(void) {
|
|
|
|
|
|
|
|
|
|
if (owd_eventloop_init(&el))
|
|
|
|
|
FAIL("failed to init event loop");
|
|
|
|
|
el_ptr = ⪙
|
|
|
|
|
|
|
|
|
|
if (owd_eventloop_add_timer(&el, &timer, 2000, false))
|
|
|
|
|
FAIL("failed to add timer");
|
|
|
|
|
@ -83,7 +102,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
struct client_conf client;
|
|
|
|
|
} conf;
|
|
|
|
|
|
|
|
|
|
return ev_test();
|
|
|
|
|
// return ev_test();
|
|
|
|
|
return al_test();
|
|
|
|
|
|
|
|
|
|
if (argc < 2)
|
|
|
|
|
return 1;
|
|
|
|
|
|