Skip to content

Commit

Permalink
sys/net/netutils: add additional test for IPV4_ADDR_LOOPBACK
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikVE committed May 30, 2023
1 parent 27e5459 commit 11299b8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/net/netutils/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ static void test_ipv4_addr_from_str__success2(void)
TEST_ASSERT(ipv4_addr_equal(&sock_dns_mock_example_com_addr_ipv4, &address));
}

static void test_ipv6_addr_from_str__success3(void)
{
static const ipv4_addr_t a = IPV4_ADDR_LOOPBACK;
ipv4_addr_t address;

TEST_ASSERT_NOT_NULL(ipv4_addr_from_str(&address, "127.0.0.1"));
TEST_ASSERT(ipv4_addr_equal(&a, &address));
}

Test *tests_netutils_ipv4_tests(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
Expand All @@ -176,6 +185,7 @@ Test *tests_netutils_ipv4_tests(void)
new_TestFixture(test_ipv4_addr_from_str__address_NULL),
new_TestFixture(test_ipv4_addr_from_str__success),
new_TestFixture(test_ipv4_addr_from_str__success2),
new_TestFixture(test_ipv6_addr_from_str__success3),
};

EMB_UNIT_TESTCALLER(ipv4_addr_tests, NULL, NULL, fixtures);
Expand Down

0 comments on commit 11299b8

Please sign in to comment.