forked from cory/tildefriends
libuv 1.48.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4828 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
26
deps/libuv/test/test-timer.c
vendored
26
deps/libuv/test/test-timer.c
vendored
@ -31,6 +31,7 @@ static int repeat_cb_called = 0;
|
||||
static int repeat_close_cb_called = 0;
|
||||
static int order_cb_called = 0;
|
||||
static int timer_check_double_call_called = 0;
|
||||
static int zero_timeout_cb_calls = 0;
|
||||
static uint64_t start_time;
|
||||
static uv_timer_t tiny_timer;
|
||||
static uv_timer_t huge_timer1;
|
||||
@ -242,6 +243,31 @@ TEST_IMPL(timer_order) {
|
||||
}
|
||||
|
||||
|
||||
static void zero_timeout_cb(uv_timer_t* handle) {
|
||||
ASSERT_OK(uv_timer_start(handle, zero_timeout_cb, 0, 0));
|
||||
uv_stop(handle->loop);
|
||||
zero_timeout_cb_calls++;
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(timer_zero_timeout) {
|
||||
uv_timer_t timer;
|
||||
uv_loop_t* loop;
|
||||
|
||||
loop = uv_default_loop();
|
||||
ASSERT_OK(uv_timer_init(loop, &timer));
|
||||
ASSERT_OK(uv_timer_start(&timer, zero_timeout_cb, 0, 0));
|
||||
ASSERT_EQ(1, uv_run(loop, UV_RUN_DEFAULT)); /* because of uv_stop() */
|
||||
ASSERT_EQ(1, zero_timeout_cb_calls);
|
||||
uv_close((uv_handle_t*) &timer, NULL);
|
||||
ASSERT_OK(uv_run(loop, UV_RUN_DEFAULT));
|
||||
ASSERT_EQ(1, zero_timeout_cb_calls);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void tiny_timer_cb(uv_timer_t* handle) {
|
||||
ASSERT_PTR_EQ(handle, &tiny_timer);
|
||||
uv_close((uv_handle_t*) &tiny_timer, NULL);
|
||||
|
Reference in New Issue
Block a user