Skip to content

Commit

Permalink
tests: provide gnrc_sock_ip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Oct 26, 2016
1 parent 6bc0a0c commit 9508c8f
Show file tree
Hide file tree
Showing 7 changed files with 1,007 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/net/gnrc/sock/ip/gnrc_sock_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ int sock_ip_create(sock_ip_t *sock, const sock_ip_ep_t *local,
}
memcpy(&sock->local, local, sizeof(sock_ip_t));
}
gnrc_sock_create(&sock->reg, GNRC_NETTYPE_IPV6,
proto);
memset(&sock->remote, 0, sizeof(sock_ip_t));
if (remote != NULL) {
if (gnrc_af_not_supported(remote->family)) {
Expand All @@ -55,6 +53,8 @@ int sock_ip_create(sock_ip_t *sock, const sock_ip_ep_t *local,
}
memcpy(&sock->remote, remote, sizeof(sock_ip_t));
}
gnrc_sock_create(&sock->reg, GNRC_NETTYPE_IPV6,
proto);
sock->flags = flags;
return 0;
}
Expand Down
20 changes: 20 additions & 0 deletions tests/gnrc_sock_ip/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
APPLICATION = gnrc_sock_ip

BOARD ?= native

RIOTBASE ?= $(CURDIR)/../..

USEMODULE += gnrc_sock_ip
USEMODULE += gnrc_ipv6
USEMODULE += ps

CFLAGS += -DDEVELHELP
CFLAGS += -DGNRC_PKTBUF_SIZE=200
CFLAGS += -DTEST_SUITES

QUIET ?= 1

include $(RIOTBASE)/Makefile.include

test:
./tests/01-run.py
43 changes: 43 additions & 0 deletions tests/gnrc_sock_ip/constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2016 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup
* @ingroup
* @brief
* @{
*
* @file
* @brief
*
* @author Martine Lenders <m.lenders@fu-berlin.de>
*/
#ifndef CONSTANTS_H_
#define CONSTANTS_H_


#ifdef __cplusplus
extern "C" {
#endif

#define _TEST_PROTO (254) /* https://tools.ietf.org/html/rfc3692#section-2.1 */
#define _TEST_NETIF (31)
#define _TEST_TIMEOUT (1000000U)
#define _TEST_ADDR_LOCAL { 0x7f, 0xc4, 0x11, 0x5a, 0xe6, 0x91, 0x8d, 0x5d, \
0x8c, 0xd1, 0x47, 0x07, 0xb7, 0x6f, 0x9b, 0x48 }
#define _TEST_ADDR_REMOTE { 0xe8, 0xb3, 0xb2, 0xe6, 0x70, 0xd4, 0x55, 0xba, \
0x93, 0xcf, 0x11, 0xe1, 0x72, 0x44, 0xc5, 0x9d }
#define _TEST_ADDR_WRONG { 0x2a, 0xce, 0x5d, 0x4e, 0xc8, 0xbf, 0x86, 0xf7, \
0x85, 0x49, 0xb4, 0x19, 0xf2, 0x28, 0xde, 0x9b }

#ifdef __cplusplus
}
#endif

#endif /* CONSTANTS_H_ */
/** @} */
Loading

0 comments on commit 9508c8f

Please sign in to comment.