1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: adapt lwip_sock_udp tests for API change

This commit is contained in:
Martine Lenders 2018-06-20 14:50:43 +02:00
parent 01ef01f08e
commit db4796b04e

View File

@ -117,6 +117,21 @@ static void test_sock_udp_create4__only_local(void)
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 const sock_udp_ep_t local = { .family = AF_INET,
@ -694,6 +709,22 @@ static void test_sock_udp_create6__only_local(void)
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 const sock_udp_ep_t local = { .family = AF_INET6,
@ -1256,6 +1287,7 @@ int main(void)
CALL(test_sock_udp_create4__EINVAL_netif());
CALL(test_sock_udp_create4__no_endpoints());
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_remote());
CALL(test_sock_udp_create4__full());
@ -1301,6 +1333,7 @@ int main(void)
CALL(test_sock_udp_create6__EINVAL_netif());
CALL(test_sock_udp_create6__no_endpoints());
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_remote());
CALL(test_sock_udp_create6__full());