tests: port gnrc_ipv6_nib unittests to gnrc_netif2

This commit is contained in:
Martine Lenders 2017-10-10 14:01:39 +02:00
parent 801148eb6d
commit 22a41ea99c
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62
2 changed files with 2 additions and 44 deletions

View File

@ -1910,33 +1910,6 @@ static void test_nib_abr_iter__three_elem_middle_removed(void)
}
#endif
/*
* Creates GNRC_NETIF_NUMOF interfaces and then tries to add another.
* Expected result: should return NULL
*/
static void test_nib_iface_get__no_space_left(void)
{
unsigned iface = 1;
for (int i = 0; i < GNRC_NETIF_NUMOF; i++) {
TEST_ASSERT_NOT_NULL(_nib_iface_get(iface++));
}
TEST_ASSERT_NULL(_nib_iface_get(iface));
}
/*
* Creates an interface and then gets the same interface.
* Expected result: interface pointers should equal
*/
static void test_nib_iface_get__success(void)
{
_nib_iface_t *ni1, *ni2;
TEST_ASSERT_NOT_NULL((ni1 = _nib_iface_get(IFACE)));
TEST_ASSERT_NOT_NULL((ni2 = _nib_iface_get(IFACE)));
TEST_ASSERT(ni1 == ni2);
}
Test *tests_gnrc_ipv6_nib_internal_tests(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
@ -2035,8 +2008,6 @@ Test *tests_gnrc_ipv6_nib_internal_tests(void)
new_TestFixture(test_nib_abr_iter__three_elem),
new_TestFixture(test_nib_abr_iter__three_elem_middle_removed),
#endif
new_TestFixture(test_nib_iface_get__no_space_left),
new_TestFixture(test_nib_iface_get__success),
};
EMB_UNIT_TESTCALLER(tests, set_up, NULL,

View File

@ -276,20 +276,12 @@ static void test_nib_nc_mark_reachable__unmanaged(void)
static void test_nib_nc_mark_reachable__success(void)
{
void *iter_state = NULL;
_nib_onl_entry_t *node;
#if GNRC_IPV6_NIB_CONF_ARSM
evtimer_msg_event_t *event;
#endif
_nib_iface_t *iface;
static const ipv6_addr_t addr = { .u64 = { { .u8 = GLOBAL_PREFIX },
{ .u64 = TEST_UINT64 } } };
gnrc_ipv6_nib_nc_t nce;
TEST_ASSERT_NOT_NULL((node = _nib_nc_add(&addr, IFACE,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE)));
/* set an "infinite" reachability time */
iface = _nib_iface_get(_nib_onl_get_if(node));
iface->reach_time = UINT32_MAX;
TEST_ASSERT_NOT_NULL(_nib_nc_add(&addr, IFACE,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE));
/* check pre-state */
TEST_ASSERT(gnrc_ipv6_nib_nc_iter(0, &iter_state, &nce));
@ -306,11 +298,6 @@ static void test_nib_nc_mark_reachable__success(void)
/* check if entry is reachable */
TEST_ASSERT_EQUAL_INT(GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE,
gnrc_ipv6_nib_nc_get_nud_state(&nce));
/* check if there now is an event for reachability timeout of node */
TEST_ASSERT_NOT_NULL((event = (evtimer_msg_event_t *)_nib_evtimer.events));
TEST_ASSERT_EQUAL_INT(GNRC_IPV6_NIB_REACH_TIMEOUT, event->msg.type);
TEST_ASSERT_MESSAGE(node == event->msg.content.ptr,
"event's context is not node");
#endif
/* check if still the only entry */
TEST_ASSERT(!gnrc_ipv6_nib_nc_iter(0, &iter_state, &nce));