unitttests/sock_util: Test null pointer in urlsplit

This commit is contained in:
Leandro Lanzieri 2019-06-11 17:28:12 +02:00
parent b9c1146e90
commit 864247d6ca

View File

@ -152,6 +152,18 @@ static void test_sock_util_urlsplit__urlpath_too_long(void)
sock_urlsplit(TEST_URL_LONG_URLPATH, addr, urlpath));
}
static void test_sock_util_urlsplit__null_addr_buffer(void)
{
TEST_ASSERT_EQUAL_INT(0, sock_urlsplit(TEST_URL, addr, NULL));
TEST_ASSERT_EQUAL_STRING(TEST_URL_HOSTPART, (char*)addr);
}
static void test_sock_util_urlsplit__null_path_buffer(void)
{
TEST_ASSERT_EQUAL_INT(0, sock_urlsplit(TEST_URL, NULL, urlpath));
TEST_ASSERT_EQUAL_STRING(TEST_URL_LOCALPART, (char*)urlpath);
}
static void test_sock_util_str2ep__ipv6_noport(void)
{
sock_udp_ep_t ep;
@ -210,6 +222,8 @@ Test *tests_sock_util_all(void)
new_TestFixture(test_sock_util_urlsplit__no_schema),
new_TestFixture(test_sock_util_urlsplit__hostport_too_long),
new_TestFixture(test_sock_util_urlsplit__urlpath_too_long),
new_TestFixture(test_sock_util_urlsplit__null_addr_buffer),
new_TestFixture(test_sock_util_urlsplit__null_path_buffer),
new_TestFixture(test_sock_util_str2ep__ipv6_noport),
new_TestFixture(test_sock_util_str2ep__ipv4_noport),
new_TestFixture(test_sock_util_str2ep__ipv4_port),