Add reference count tests

Broken on UNIX.
This commit is contained in:
Ryan Dahl 2011-05-20 08:22:19 -07:00
parent c8603a7462
commit 1352c72e35
2 changed files with 62 additions and 0 deletions

View File

@ -32,6 +32,11 @@ TEST_DECLARE (callback_stack)
TEST_DECLARE (timer)
TEST_DECLARE (timer_again)
TEST_DECLARE (loop_handles)
TEST_DECLARE (ref)
TEST_DECLARE (idle_ref)
TEST_DECLARE (async_ref)
TEST_DECLARE (prepare_ref)
TEST_DECLARE (check_ref)
TEST_DECLARE (async)
TEST_DECLARE (fail_always)
TEST_DECLARE (pass_always)
@ -65,6 +70,12 @@ TASK_LIST_START
TEST_ENTRY (timer_again)
TEST_ENTRY (ref)
TEST_ENTRY (idle_ref)
TEST_ENTRY (async_ref)
TEST_ENTRY (prepare_ref)
TEST_ENTRY (check_ref)
TEST_ENTRY (loop_handles)
TEST_ENTRY (async)
@ -75,3 +86,4 @@ TASK_LIST_START
TEST_ENTRY (pass_always)
#endif
TASK_LIST_END

View File

@ -384,3 +384,53 @@ TEST_IMPL(loop_handles) {
return 0;
}
TEST_IMPL(ref) {
uv_init(alloc_cb);
uv_run();
return 0;
}
TEST_IMPL(idle_ref) {
uv_handle_t h;
uv_init(alloc_cb);
uv_idle_init(&h, NULL, NULL);
uv_idle_start(&h, NULL);
uv_unref(&h);
uv_run();
return 0;
}
TEST_IMPL(async_ref) {
uv_handle_t h;
uv_init(alloc_cb);
uv_async_init(&h, NULL, NULL, NULL);
uv_unref(&h);
uv_run();
return 0;
}
TEST_IMPL(prepare_ref) {
uv_handle_t h;
uv_init(alloc_cb);
uv_prepare_init(&h, NULL, NULL);
uv_prepare_start(&h, NULL);
uv_unref(&h);
uv_run();
return 0;
}
TEST_IMPL(check_ref) {
uv_handle_t h;
uv_init(alloc_cb);
uv_check_init(&h, NULL, NULL);
uv_check_start(&h, NULL);
uv_unref(&h);
uv_run();
return 0;
}