libuv 1.47.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-11-07 17:30:39 +00:00
parent 889773c38d
commit ee9cb63327
226 changed files with 6648 additions and 6444 deletions

View File

@ -30,9 +30,9 @@ int cookie3;
TEST_IMPL(handle_type_name) {
ASSERT(strcmp(uv_handle_type_name(UV_NAMED_PIPE), "pipe") == 0);
ASSERT(strcmp(uv_handle_type_name(UV_UDP), "udp") == 0);
ASSERT(strcmp(uv_handle_type_name(UV_FILE), "file") == 0);
ASSERT_OK(strcmp(uv_handle_type_name(UV_NAMED_PIPE), "pipe"));
ASSERT_OK(strcmp(uv_handle_type_name(UV_UDP), "udp"));
ASSERT_OK(strcmp(uv_handle_type_name(UV_FILE), "file"));
ASSERT_NULL(uv_handle_type_name(UV_HANDLE_TYPE_MAX));
ASSERT_NULL(uv_handle_type_name(UV_HANDLE_TYPE_MAX + 1));
ASSERT_NULL(uv_handle_type_name(UV_UNKNOWN_HANDLE));
@ -41,9 +41,9 @@ TEST_IMPL(handle_type_name) {
TEST_IMPL(req_type_name) {
ASSERT(strcmp(uv_req_type_name(UV_REQ), "req") == 0);
ASSERT(strcmp(uv_req_type_name(UV_UDP_SEND), "udp_send") == 0);
ASSERT(strcmp(uv_req_type_name(UV_WORK), "work") == 0);
ASSERT_OK(strcmp(uv_req_type_name(UV_REQ), "req"));
ASSERT_OK(strcmp(uv_req_type_name(UV_UDP_SEND), "udp_send"));
ASSERT_OK(strcmp(uv_req_type_name(UV_WORK), "work"));
ASSERT_NULL(uv_req_type_name(UV_REQ_TYPE_MAX));
ASSERT_NULL(uv_req_type_name(UV_REQ_TYPE_MAX + 1));
ASSERT_NULL(uv_req_type_name(UV_UNKNOWN_REQ));
@ -60,48 +60,48 @@ TEST_IMPL(getters_setters) {
loop = malloc(uv_loop_size());
ASSERT_NOT_NULL(loop);
r = uv_loop_init(loop);
ASSERT(r == 0);
ASSERT_OK(r);
uv_loop_set_data(loop, &cookie1);
ASSERT(loop->data == &cookie1);
ASSERT(uv_loop_get_data(loop) == &cookie1);
ASSERT_PTR_EQ(loop->data, &cookie1);
ASSERT_PTR_EQ(uv_loop_get_data(loop), &cookie1);
pipe = malloc(uv_handle_size(UV_NAMED_PIPE));
r = uv_pipe_init(loop, pipe, 0);
ASSERT(r == 0);
ASSERT(uv_handle_get_type((uv_handle_t*)pipe) == UV_NAMED_PIPE);
ASSERT_OK(r);
ASSERT_EQ(uv_handle_get_type((uv_handle_t*)pipe), UV_NAMED_PIPE);
ASSERT(uv_handle_get_loop((uv_handle_t*)pipe) == loop);
ASSERT_PTR_EQ(uv_handle_get_loop((uv_handle_t*)pipe), loop);
pipe->data = &cookie2;
ASSERT(uv_handle_get_data((uv_handle_t*)pipe) == &cookie2);
ASSERT_PTR_EQ(uv_handle_get_data((uv_handle_t*)pipe), &cookie2);
uv_handle_set_data((uv_handle_t*)pipe, &cookie1);
ASSERT(uv_handle_get_data((uv_handle_t*)pipe) == &cookie1);
ASSERT(pipe->data == &cookie1);
ASSERT_PTR_EQ(uv_handle_get_data((uv_handle_t*)pipe), &cookie1);
ASSERT_PTR_EQ(pipe->data, &cookie1);
ASSERT(uv_stream_get_write_queue_size((uv_stream_t*)pipe) == 0);
ASSERT_OK(uv_stream_get_write_queue_size((uv_stream_t*)pipe));
pipe->write_queue_size++;
ASSERT(uv_stream_get_write_queue_size((uv_stream_t*)pipe) == 1);
ASSERT_EQ(1, uv_stream_get_write_queue_size((uv_stream_t*)pipe));
pipe->write_queue_size--;
uv_close((uv_handle_t*)pipe, NULL);
r = uv_run(loop, UV_RUN_DEFAULT);
ASSERT(r == 0);
ASSERT_OK(r);
fs = malloc(uv_req_size(UV_FS));
uv_fs_stat(loop, fs, ".", NULL);
r = uv_run(loop, UV_RUN_DEFAULT);
ASSERT(r == 0);
ASSERT_OK(r);
ASSERT(uv_fs_get_type(fs) == UV_FS_STAT);
ASSERT(uv_fs_get_result(fs) == 0);
ASSERT(uv_fs_get_ptr(fs) == uv_fs_get_statbuf(fs));
ASSERT_EQ(uv_fs_get_type(fs), UV_FS_STAT);
ASSERT_OK(uv_fs_get_result(fs));
ASSERT_PTR_EQ(uv_fs_get_ptr(fs), uv_fs_get_statbuf(fs));
ASSERT(uv_fs_get_statbuf(fs)->st_mode & S_IFDIR);
ASSERT(strcmp(uv_fs_get_path(fs), ".") == 0);
ASSERT_OK(strcmp(uv_fs_get_path(fs), "."));
uv_fs_req_cleanup(fs);
r = uv_loop_close(loop);
ASSERT(r == 0);
ASSERT_OK(r);
free(pipe);
free(fs);