Skip to content

Commit 5b00718

Browse files
jukkarnashif
authored andcommitted
tests: posix: headers: net: Convert to use zexpect
Use zexpect instead of zassert so that the failed tests do not stop the test execution but we run all the tests. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent d1e42fc commit 5b00718

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

tests/posix/headers/src/netinet_in_h.c

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@
2121
*/
2222
ZTEST(posix_headers, test_netinet_in_h)
2323
{
24-
zassert_equal(sizeof(in_port_t), sizeof(uint16_t));
25-
zassert_equal(sizeof(in_addr_t), sizeof(uint32_t));
24+
zexpect_equal(sizeof(in_port_t), sizeof(uint16_t));
25+
zexpect_equal(sizeof(in_addr_t), sizeof(uint32_t));
2626

27-
zassert_not_equal(-1, offsetof(struct in_addr, s_addr));
27+
zexpect_not_equal(-1, offsetof(struct in_addr, s_addr));
2828

29-
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_family));
30-
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_port));
31-
zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_addr));
29+
zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_family));
30+
zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_port));
31+
zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_addr));
3232

33-
zassert_not_equal(-1, offsetof(struct in6_addr, s6_addr));
34-
zassert_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t));
33+
zexpect_not_equal(-1, offsetof(struct in6_addr, s6_addr));
34+
zexpect_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t));
3535

36-
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family));
37-
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port));
36+
zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family));
37+
zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port));
3838
/* not implemented */
39-
/* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */
40-
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr));
41-
zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id));
39+
/* zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */
40+
zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr));
41+
zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id));
4242

43-
zassert_not_null(&in6addr_any);
44-
zassert_not_null(&in6addr_loopback);
43+
zexpect_not_null(&in6addr_any);
44+
zexpect_not_null(&in6addr_loopback);
4545
struct in6_addr any6 = IN6ADDR_ANY_INIT;
4646
struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT;
4747

@@ -62,42 +62,42 @@ ZTEST(posix_headers, test_netinet_in_h)
6262
struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0,
6363
0, 0, 0, 0, 0, 0, 0, 0x01 } } };
6464

65-
zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr));
66-
zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex));
67-
68-
zassert_not_equal(-1, IPPROTO_IP);
69-
zassert_not_equal(-1, IPPROTO_IPV6);
70-
zassert_not_equal(-1, IPPROTO_ICMP);
71-
zassert_not_equal(-1, IPPROTO_RAW);
72-
zassert_not_equal(-1, IPPROTO_TCP);
73-
zassert_not_equal(-1, IPPROTO_UDP);
74-
75-
zassert_not_equal(-1, INADDR_ANY);
76-
zassert_equal(0xffffffff, INADDR_BROADCAST);
77-
78-
zassert_equal(INET_ADDRSTRLEN, 16);
79-
zassert_equal(INET6_ADDRSTRLEN, 46);
80-
81-
zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP);
82-
zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP);
83-
zassert_not_equal(-1, IPV6_MULTICAST_HOPS);
84-
/* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */
85-
/* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */
86-
zassert_not_equal(-1, IPV6_UNICAST_HOPS);
87-
zassert_not_equal(-1, IPV6_V6ONLY);
88-
89-
zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6));
90-
zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6));
91-
92-
zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6));
93-
zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6));
94-
zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6));
95-
zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped));
65+
zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr));
66+
zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex));
67+
68+
zexpect_not_equal(-1, IPPROTO_IP);
69+
zexpect_not_equal(-1, IPPROTO_IPV6);
70+
zexpect_not_equal(-1, IPPROTO_ICMP);
71+
zexpect_not_equal(-1, IPPROTO_RAW);
72+
zexpect_not_equal(-1, IPPROTO_TCP);
73+
zexpect_not_equal(-1, IPPROTO_UDP);
74+
75+
zexpect_not_equal(-1, INADDR_ANY);
76+
zexpect_equal(0xffffffff, INADDR_BROADCAST);
77+
78+
zexpect_equal(INET_ADDRSTRLEN, 16);
79+
zexpect_equal(INET6_ADDRSTRLEN, 46);
80+
81+
zexpect_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP);
82+
zexpect_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP);
83+
zexpect_not_equal(-1, IPV6_MULTICAST_HOPS);
84+
/* zexpect_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */
85+
/* zexpect_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */
86+
zexpect_not_equal(-1, IPV6_UNICAST_HOPS);
87+
zexpect_not_equal(-1, IPV6_V6ONLY);
88+
89+
zexpect_true(IN6_IS_ADDR_UNSPECIFIED(&any6));
90+
zexpect_true(IN6_IS_ADDR_LOOPBACK(&lo6));
91+
92+
zexpect_true(IN6_IS_ADDR_MULTICAST(&mcast6));
93+
zexpect_true(IN6_IS_ADDR_LINKLOCAL(&ll6));
94+
zexpect_true(IN6_IS_ADDR_SITELOCAL(&sl6));
95+
zexpect_true(IN6_IS_ADDR_V4MAPPED(&v4mapped));
9696
/* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */
97-
zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6));
98-
zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6));
99-
zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6));
100-
zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6));
101-
zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6));
97+
zexpect_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6));
98+
zexpect_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6));
99+
zexpect_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6));
100+
zexpect_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6));
101+
zexpect_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6));
102102
}
103103
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)