summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-31 15:05:31 +0200
committerThomas Haller <thaller@redhat.com>2020-08-05 10:22:10 +0200
commit77c000aa0b1eb8d5f7dc010f7b07e8673feff0b6 (patch)
tree5368e728b8543899d496a245e1212e56bb53d0fe
parent5150e45fccb4436f49158244848910f4a4c45914 (diff)
downloadNetworkManager-77c000aa0b1eb8d5f7dc010f7b07e8673feff0b6.tar.gz
shared/tests: add nmtst_assert_ip_address()
-rw-r--r--shared/nm-utils/nm-test-utils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index b43e233007..1e3a99eb82 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -1505,6 +1505,14 @@ _nmtst_assert_ip6_address (const char *file, int line, const struct in6_addr *ad
}
#define nmtst_assert_ip6_address(addr, str_expected) _nmtst_assert_ip6_address (__FILE__, __LINE__, addr, str_expected)
+#define nmtst_assert_ip_address(addr_family, addr, str_expected) \
+ G_STMT_START { \
+ if (NM_IS_IPv4 (addr_family)) \
+ nmtst_assert_ip4_address (*((const in_addr_t *) (addr)), (str_expected)); \
+ else \
+ nmtst_assert_ip6_address ((const struct in6_addr *) (addr), (str_expected)); \
+ } G_STMT_END
+
#define nmtst_spawn_sync(working_directory, standard_out, standard_err, assert_exit_status, ...) \
__nmtst_spawn_sync (working_directory, standard_out, standard_err, assert_exit_status, ##__VA_ARGS__, NULL)
static inline int