1 /*
2 * Copyright (c) 2024, Friedt Professional Engineering Services, Inc
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/posix/arpa/inet.h>
8 #include <zephyr/posix/netinet/in.h>
9
10 #include <zephyr/ztest.h>
11
ZTEST(net,test_inet_ntoa)12 ZTEST(net, test_inet_ntoa)
13 {
14 struct in_addr in;
15
16 in.s_addr = htonl(0x7f000001);
17 zassert_mem_equal(inet_ntoa(in), "127.0.0.1", strlen("127.0.0.1") + 1);
18
19 in.s_addr = htonl(0);
20 zassert_mem_equal(inet_ntoa(in), "0.0.0.0", strlen("0.0.0.0") + 1);
21
22 in.s_addr = htonl(0xffffffff);
23 zassert_mem_equal(inet_ntoa(in), "255.255.255.255", strlen("255.255.255.255") + 1);
24 }
25