mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
tests/unittests/ipv6_addr: Add tests for ipv6_addr_split_iface
This commit is contained in:
parent
39984b1f51
commit
b5930af760
@ -1026,6 +1026,22 @@ static void test_ipv6_addr_from_str__success6(void)
|
||||
TEST_ASSERT(ipv6_addr_equal(&a, &result));
|
||||
}
|
||||
|
||||
static void test_ipv6_addr_split_iface__no_iface(void)
|
||||
{
|
||||
char a[] = "fe80::f8f9:fafb:fcfd:feff";
|
||||
TEST_ASSERT_NULL(ipv6_addr_split_iface(a));
|
||||
}
|
||||
|
||||
static void test_ipv6_addr_split_iface__with_iface(void)
|
||||
{
|
||||
char a[] = "fe80::f8f9:fafb:fcfd:feff%eth0";
|
||||
char *iface = ipv6_addr_split_iface(a);
|
||||
TEST_ASSERT_NOT_NULL(iface);
|
||||
TEST_ASSERT_EQUAL_INT(strcmp("eth0", iface), 0);
|
||||
/* check that the separator has been replaced with '\0' */
|
||||
TEST_ASSERT_EQUAL_INT(*(iface - 1), '\0');
|
||||
}
|
||||
|
||||
Test *tests_ipv6_addr_tests(void)
|
||||
{
|
||||
EMB_UNIT_TESTFIXTURES(fixtures) {
|
||||
@ -1114,6 +1130,8 @@ Test *tests_ipv6_addr_tests(void)
|
||||
new_TestFixture(test_ipv6_addr_from_str__success4),
|
||||
new_TestFixture(test_ipv6_addr_from_str__success5),
|
||||
new_TestFixture(test_ipv6_addr_from_str__success6),
|
||||
new_TestFixture(test_ipv6_addr_split_iface__no_iface),
|
||||
new_TestFixture(test_ipv6_addr_split_iface__with_iface),
|
||||
};
|
||||
|
||||
EMB_UNIT_TESTCALLER(ipv6_addr_tests, NULL, NULL, fixtures);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user