Skip to content
Snippets Groups Projects
Commit db4796b0 authored by Martine Lenders's avatar Martine Lenders
Browse files

tests: adapt lwip_sock_udp tests for API change

parent 01ef01f0
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,21 @@ static void test_sock_udp_create4__only_local(void) ...@@ -117,6 +117,21 @@ static void test_sock_udp_create4__only_local(void)
assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep)); assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep));
} }
static void test_sock_udp_create4__only_local_port0(void)
{
static const sock_udp_ep_t local = { .family = AF_INET,
.port = 0U };
sock_udp_ep_t ep;
assert(0 == sock_udp_create(&_sock, &local, NULL, SOCK_FLAGS_REUSE_EP));
assert(0 == sock_udp_get_local(&_sock, &ep));
assert(AF_INET == ep.family);
assert(0 == ep.addr.ipv4_u32);
assert(SOCK_ADDR_ANY_NETIF == ep.netif);
assert(0U != ep.port);
assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep));
}
static void test_sock_udp_create4__only_local_reuse_ep(void) static void test_sock_udp_create4__only_local_reuse_ep(void)
{ {
static const sock_udp_ep_t local = { .family = AF_INET, static const sock_udp_ep_t local = { .family = AF_INET,
...@@ -694,6 +709,22 @@ static void test_sock_udp_create6__only_local(void) ...@@ -694,6 +709,22 @@ static void test_sock_udp_create6__only_local(void)
assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep)); assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep));
} }
static void test_sock_udp_create6__only_local_port0(void)
{
static const sock_udp_ep_t local = { .family = AF_INET6,
.port = 0U };
sock_udp_ep_t ep;
assert(0 == sock_udp_create(&_sock, &local, NULL, SOCK_FLAGS_REUSE_EP));
assert(0 == sock_udp_get_local(&_sock, &ep));
assert(AF_INET6 == ep.family);
assert(memcmp(&ipv6_addr_unspecified, &ep.addr.ipv6,
sizeof(ipv6_addr_t)) == 0);
assert(SOCK_ADDR_ANY_NETIF == ep.netif);
assert(0U != ep.port);
assert(-ENOTCONN == sock_udp_get_remote(&_sock, &ep));
}
static void test_sock_udp_create6__only_local_reuse_ep(void) static void test_sock_udp_create6__only_local_reuse_ep(void)
{ {
static const sock_udp_ep_t local = { .family = AF_INET6, static const sock_udp_ep_t local = { .family = AF_INET6,
...@@ -1256,6 +1287,7 @@ int main(void) ...@@ -1256,6 +1287,7 @@ int main(void)
CALL(test_sock_udp_create4__EINVAL_netif()); CALL(test_sock_udp_create4__EINVAL_netif());
CALL(test_sock_udp_create4__no_endpoints()); CALL(test_sock_udp_create4__no_endpoints());
CALL(test_sock_udp_create4__only_local()); CALL(test_sock_udp_create4__only_local());
CALL(test_sock_udp_create4__only_local_port0());
CALL(test_sock_udp_create4__only_local_reuse_ep()); CALL(test_sock_udp_create4__only_local_reuse_ep());
CALL(test_sock_udp_create4__only_remote()); CALL(test_sock_udp_create4__only_remote());
CALL(test_sock_udp_create4__full()); CALL(test_sock_udp_create4__full());
...@@ -1301,6 +1333,7 @@ int main(void) ...@@ -1301,6 +1333,7 @@ int main(void)
CALL(test_sock_udp_create6__EINVAL_netif()); CALL(test_sock_udp_create6__EINVAL_netif());
CALL(test_sock_udp_create6__no_endpoints()); CALL(test_sock_udp_create6__no_endpoints());
CALL(test_sock_udp_create6__only_local()); CALL(test_sock_udp_create6__only_local());
CALL(test_sock_udp_create6__only_local_port0());
CALL(test_sock_udp_create6__only_local_reuse_ep()); CALL(test_sock_udp_create6__only_local_reuse_ep());
CALL(test_sock_udp_create6__only_remote()); CALL(test_sock_udp_create6__only_remote());
CALL(test_sock_udp_create6__full()); CALL(test_sock_udp_create6__full());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment