Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Feb 28, 2024
1 parent 2252cd0 commit f7e2e28
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions test/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -6344,7 +6344,7 @@ START_TEST(test_ulfius_shared_data)
}
END_TEST

#if MHD_VERSION < 0x01000000
#if MHD_VERSION != 0x01000000
START_TEST(test_ulfius_malformed_requests)
{
struct _u_instance u_instance;
Expand Down Expand Up @@ -6401,6 +6401,41 @@ START_TEST(test_ulfius_malformed_requests)
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_1, o_strlen(request_1), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_2, o_strlen(request_2), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_3, o_strlen(request_3), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_4, o_strlen(request_4), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_5, o_strlen(request_5), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_6, o_strlen(request_6), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ck_assert_int_gt(socket = socket_connect_localhost(8080), -1);
send(socket, request_7, o_strlen(request_7), MSG_NOSIGNAL);
shutdown(socket, SHUT_WR);
close(socket);

ulfius_clean_request(&request);
ulfius_stop_framework(&u_instance);
ulfius_clean_instance(&u_instance);
Expand Down Expand Up @@ -7020,7 +7055,7 @@ static Suite *ulfius_suite(void)
tcase_add_test(tc_core, test_ulfius_send_rich_smtp);
tcase_add_test(tc_core, test_ulfius_follow_redirect);
tcase_add_test(tc_core, test_ulfius_shared_data);
#if MHD_VERSION < 0x01000000
#if MHD_VERSION != 0x01000000
tcase_add_test(tc_core, test_ulfius_malformed_requests);
#endif
tcase_add_test(tc_core, test_ulfius_large_posts_check_utf8_no);
Expand Down

0 comments on commit f7e2e28

Please sign in to comment.