|
| 1 | +/* |
| 2 | + * Copyright (c) 2022 Meta |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#include "_common.h" |
| 8 | +#include "_headers.h" |
| 9 | + |
| 10 | +/** |
| 11 | + * @brief existence test for `<netdb.h>` |
| 12 | + * |
| 13 | + * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html>netdb.h</a> |
| 14 | + */ |
| 15 | +ZTEST(posix_headers, test_netdb_h) |
| 16 | +{ |
| 17 | + /* zassert_not_equal(-1, offsetof(struct hostent, h_name)); */ /* not implemented */ |
| 18 | + /* zassert_not_equal(-1, offsetof(struct hostent, h_aliases)); */ /* not implemented */ |
| 19 | + /* zassert_not_equal(-1, offsetof(struct hostent, h_addrtype)); */ /* not implemented */ |
| 20 | + /* zassert_not_equal(-1, offsetof(struct hostent, h_length)); */ /* not implemented */ |
| 21 | + /* zassert_not_equal(-1, offsetof(struct hostent, h_addr_list)); */ /* not implemented */ |
| 22 | + |
| 23 | + /* zassert_not_equal(-1, offsetof(struct netent, n_name)); */ /* not implemented */ |
| 24 | + /* zassert_not_equal(-1, offsetof(struct netent, n_aliases)); */ /* not implemented */ |
| 25 | + /* zassert_not_equal(-1, offsetof(struct netent, n_addrtype)); */ /* not implemented */ |
| 26 | + /* zassert_not_equal(-1, offsetof(struct netent, n_net)); */ /* not implemented */ |
| 27 | + |
| 28 | + /* zassert_not_equal(-1, offsetof(struct protoent, p_name)); */ /* not implemented */ |
| 29 | + /* zassert_not_equal(-1, offsetof(struct protoent, p_aliases)); */ /* not implemented */ |
| 30 | + /* zassert_not_equal(-1, offsetof(struct protoent, p_proto)); */ /* not implemented */ |
| 31 | + |
| 32 | + /* zassert_not_equal(-1, offsetof(struct servent, s_name)); */ /* not implemented */ |
| 33 | + /* zassert_not_equal(-1, offsetof(struct servent, s_aliases)); */ /* not implemented */ |
| 34 | + /* zassert_not_equal(-1, offsetof(struct servent, s_port)); */ /* not implemented */ |
| 35 | + /* zassert_not_equal(-1, offsetof(struct servent, s_proto)); */ /* not implemented */ |
| 36 | + |
| 37 | + /* zassert_equal(IPPORT_RESERVED, UINT16_MAX); */ /* not implemented */ |
| 38 | + |
| 39 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_flags)); |
| 40 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_family)); |
| 41 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_socktype)); |
| 42 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_protocol)); |
| 43 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_addrlen)); |
| 44 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_addr)); |
| 45 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_canonname)); |
| 46 | + zassert_not_equal(-1, offsetof(struct addrinfo, ai_next)); |
| 47 | + |
| 48 | + zassert_not_equal(-1, AI_PASSIVE); |
| 49 | + zassert_not_equal(-1, AI_CANONNAME); |
| 50 | + zassert_not_equal(-1, AI_NUMERICHOST); |
| 51 | + zassert_not_equal(-1, AI_NUMERICSERV); |
| 52 | + zassert_not_equal(-1, AI_V4MAPPED); |
| 53 | + zassert_not_equal(-1, AI_ALL); |
| 54 | + zassert_not_equal(-1, AI_ADDRCONFIG); |
| 55 | + |
| 56 | + zassert_not_equal(-1, NI_NOFQDN); |
| 57 | + zassert_not_equal(-1, NI_NUMERICHOST); |
| 58 | + zassert_not_equal(-1, NI_NAMEREQD); |
| 59 | + zassert_not_equal(-1, NI_NUMERICSERV); |
| 60 | + /* zassert_not_equal(-1, NI_NUMERICSCOPE); */ /* not implemented */ |
| 61 | + zassert_not_equal(-1, NI_DGRAM); |
| 62 | + |
| 63 | + zassert_not_equal(-1, EAI_AGAIN); |
| 64 | + zassert_equal(-1, EAI_BADFLAGS); |
| 65 | + zassert_not_equal(-1, EAI_FAIL); |
| 66 | + zassert_not_equal(-1, EAI_FAMILY); |
| 67 | + zassert_not_equal(-1, EAI_MEMORY); |
| 68 | + zassert_not_equal(-1, EAI_NONAME); |
| 69 | + zassert_not_equal(-1, EAI_SERVICE); |
| 70 | + zassert_not_equal(-1, EAI_SOCKTYPE); |
| 71 | + zassert_not_equal(-1, EAI_SYSTEM); |
| 72 | + zassert_not_equal(-1, EAI_OVERFLOW); |
| 73 | + |
| 74 | + if (IS_ENABLED(CONFIG_POSIX_API)) { |
| 75 | + /* zassert_not_null(endhostent); */ /* not implemented */ |
| 76 | + /* zassert_not_null(endnetent); */ /* not implemented */ |
| 77 | + /* zassert_not_null(endprotoent); */ /* not implemented */ |
| 78 | + /* zassert_not_null(endservent); */ /* not implemented */ |
| 79 | + zassert_not_null(freeaddrinfo); |
| 80 | + zassert_not_null(gai_strerror); |
| 81 | + zassert_not_null(getaddrinfo); |
| 82 | + /* zassert_not_null(gethostent); */ /* not implemented */ |
| 83 | + zassert_not_null(getnameinfo); |
| 84 | + /* zassert_not_null(getnetbyaddr); */ /* not implemented */ |
| 85 | + /* zassert_not_null(getnetbyname); */ /* not implemented */ |
| 86 | + /* zassert_not_null(getnetent); */ /* not implemented */ |
| 87 | + /* zassert_not_null(getprotobyname); */ /* not implemented */ |
| 88 | + /* zassert_not_null(getprotobynumber); */ /* not implemented */ |
| 89 | + /* zassert_not_null(getprotoent); */ /* not implemented */ |
| 90 | + /* zassert_not_null(getservbyname); */ /* not implemented */ |
| 91 | + /* zassert_not_null(getservbyport); */ /* not implemented */ |
| 92 | + /* zassert_not_null(getservent); */ /* not implemented */ |
| 93 | + /* zassert_not_null(sethostent); */ /* not implemented */ |
| 94 | + /* zassert_not_null(setnetent); */ /* not implemented */ |
| 95 | + /* zassert_not_null(setprotoent); */ /* not implemented */ |
| 96 | + /* zassert_not_null(setservent); */ /* not implemented */ |
| 97 | + } |
| 98 | +} |
0 commit comments