summary refs log tree commit diff
path: root/clients/common/tests
diff options
context:
space:
mode:
Diffstat (limited to 'clients/common/tests')
-rw-r--r--clients/common/tests/test-clients-common.c564
-rw-r--r--clients/common/tests/test-libnm-core-aux.c424
2 files changed, 517 insertions, 471 deletions
diff --git a/clients/common/tests/test-clients-common.c b/clients/common/tests/test-clients-common.c
index 0b61e7bb..8a59d4e2 100644
--- a/clients/common/tests/test-clients-common.c
+++ b/clients/common/tests/test-clients-common.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2017 Red Hat, Inc.
  */
@@ -14,313 +14,345 @@
 /*****************************************************************************/
 
 static void
-test_client_meta_check (void)
+test_client_meta_check(void)
 {
-	const NMMetaSettingInfoEditor *const*infos_p;
-	NMMetaSettingType m;
-	guint p;
-
-	G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaSettingInfoEditor, meta_type));
-	G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaPropertyInfo, meta_type));
-
-	for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
-		const NMMetaSettingInfo *info = &nm_meta_setting_infos[m];
-		GType gtype;
-
-		g_assert (info);
-		g_assert (info->meta_type == m);
-		g_assert (info->setting_name);
-		g_assert (info->get_setting_gtype);
-
-		gtype = info->get_setting_gtype ();
-		g_assert (gtype != NM_TYPE_SETTING);
-
-		{
-			nm_auto_unref_gtypeclass GTypeClass *gclass = g_type_class_ref (gtype);
-
-			g_assert (G_TYPE_CHECK_CLASS_TYPE (gclass, gtype));
-		}
-		{
-			gs_unref_object NMSetting *setting = g_object_new (gtype, NULL);
-
-			g_assert (NM_IS_SETTING (setting));
-			g_assert (G_TYPE_CHECK_INSTANCE_TYPE (setting, gtype));
-			g_assert_cmpstr (nm_setting_get_name (setting), ==, info->setting_name);
-		}
-	}
-
-	for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
-		const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
-
-		g_assert (info);
-		g_assert (info->meta_type == &nm_meta_type_setting_info_editor);
-		g_assert (info->general);
-		g_assert (info->general == &nm_meta_setting_infos[m]);
-
-		g_assert_cmpstr (info->general->setting_name, ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, FALSE));
-		g_assert_cmpstr ("name", ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, TRUE));
-
-		g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties));
-
-		if (info->properties_num) {
-			gs_unref_hashtable GHashTable *property_names = g_hash_table_new (nm_str_hash, g_str_equal);
-
-			g_assert (info->properties);
-			for (p = 0; p < info->properties_num; p++) {
-				const NMMetaPropertyInfo *pi = info->properties[p];
-
-				g_assert (pi);
-				g_assert (pi->meta_type == &nm_meta_type_property_info);
-				g_assert (pi->setting_info == info);
-				g_assert (pi->property_name);
-
-				g_assert (g_hash_table_add (property_names, (gpointer) pi->property_name));
-
-				g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE));
-				g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE));
-
-				g_assert (pi->property_type);
-				g_assert (pi->property_type->get_fcn);
-			}
-			g_assert (!info->properties[info->properties_num]);
-		} else
-			g_assert (!info->properties);
-
-		if (info->valid_parts) {
-			gsize i, l;
-			gs_unref_hashtable GHashTable *dup = g_hash_table_new (nm_direct_hash, NULL);
-
-			l = NM_PTRARRAY_LEN (info->valid_parts);
-			g_assert (l >= 2);
-
-			for (i = 0; info->valid_parts[i]; i++) {
-				g_assert (info->valid_parts[i]->setting_info);
-				g_assert (g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info));
-
-				if (i == 0) {
-					g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]);
-					g_assert (info->valid_parts[i]->mandatory);
-				}
-				if (i == 1) {
-					g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[m]);
-					g_assert (info->valid_parts[i]->mandatory);
-				}
-			}
-			g_assert (i == l);
-		}
-	}
-
-	for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
-		const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
-
-		g_assert (nm_meta_setting_info_editor_find_by_name (info->general->setting_name, FALSE) == info);
-		g_assert (nm_meta_setting_info_editor_find_by_gtype (info->general->get_setting_gtype ()) == info);
-
-		for (p = 0; p < info->properties_num; p++) {
-			const NMMetaPropertyInfo *pi = info->properties[p];
-
-			g_assert (nm_meta_setting_info_editor_get_property_info (info, pi->property_name) == pi);
-			g_assert (nm_meta_property_info_find_by_name (info->general->setting_name, pi->property_name) == pi);
-		}
-	}
-
-	infos_p = nm_meta_setting_infos_editor_p ();
-	g_assert (infos_p);
-	for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++)
-		g_assert (infos_p[m] == &nm_meta_setting_infos_editor[m]);
-	g_assert (!infos_p[m]);
+    const NMMetaSettingInfoEditor *const *infos_p;
+    NMMetaSettingType                     m;
+    guint                                 p;
+
+    G_STATIC_ASSERT(G_STRUCT_OFFSET(NMMetaAbstractInfo, meta_type)
+                    == G_STRUCT_OFFSET(NMMetaSettingInfoEditor, meta_type));
+    G_STATIC_ASSERT(G_STRUCT_OFFSET(NMMetaAbstractInfo, meta_type)
+                    == G_STRUCT_OFFSET(NMMetaPropertyInfo, meta_type));
+
+    for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
+        const NMMetaSettingInfo *info = &nm_meta_setting_infos[m];
+        GType                    gtype;
+
+        g_assert(info);
+        g_assert(info->meta_type == m);
+        g_assert(info->setting_name);
+        g_assert(info->get_setting_gtype);
+
+        gtype = info->get_setting_gtype();
+        g_assert(gtype != NM_TYPE_SETTING);
+
+        {
+            nm_auto_unref_gtypeclass GTypeClass *gclass = g_type_class_ref(gtype);
+
+            g_assert(G_TYPE_CHECK_CLASS_TYPE(gclass, gtype));
+        }
+        {
+            gs_unref_object NMSetting *setting = g_object_new(gtype, NULL);
+
+            g_assert(NM_IS_SETTING(setting));
+            g_assert(G_TYPE_CHECK_INSTANCE_TYPE(setting, gtype));
+            g_assert_cmpstr(nm_setting_get_name(setting), ==, info->setting_name);
+        }
+    }
+
+    for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
+        const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
+
+        g_assert(info);
+        g_assert(info->meta_type == &nm_meta_type_setting_info_editor);
+        g_assert(info->general);
+        g_assert(info->general == &nm_meta_setting_infos[m]);
+
+        g_assert_cmpstr(info->general->setting_name,
+                        ==,
+                        info->meta_type->get_name((const NMMetaAbstractInfo *) info, FALSE));
+        g_assert_cmpstr("name",
+                        ==,
+                        info->meta_type->get_name((const NMMetaAbstractInfo *) info, TRUE));
+
+        g_assert(info->properties_num == NM_PTRARRAY_LEN(info->properties));
+
+        if (info->properties_num) {
+            gs_unref_hashtable GHashTable *property_names =
+                g_hash_table_new(nm_str_hash, g_str_equal);
+
+            g_assert(info->properties);
+            for (p = 0; p < info->properties_num; p++) {
+                const NMMetaPropertyInfo *pi = info->properties[p];
+
+                g_assert(pi);
+                g_assert(pi->meta_type == &nm_meta_type_property_info);
+                g_assert(pi->setting_info == info);
+                g_assert(pi->property_name);
+
+                g_assert(g_hash_table_add(property_names, (gpointer) pi->property_name));
+
+                g_assert_cmpstr(pi->property_name,
+                                ==,
+                                pi->meta_type->get_name((const NMMetaAbstractInfo *) pi, FALSE));
+                g_assert_cmpstr(pi->property_name,
+                                ==,
+                                pi->meta_type->get_name((const NMMetaAbstractInfo *) pi, TRUE));
+
+                g_assert(pi->property_type);
+                g_assert(pi->property_type->get_fcn);
+            }
+            g_assert(!info->properties[info->properties_num]);
+        } else
+            g_assert(!info->properties);
+
+        if (info->valid_parts) {
+            gsize              i, l;
+            gs_unref_hashtable GHashTable *dup = g_hash_table_new(nm_direct_hash, NULL);
+
+            l = NM_PTRARRAY_LEN(info->valid_parts);
+            g_assert(l >= 2);
+
+            for (i = 0; info->valid_parts[i]; i++) {
+                g_assert(info->valid_parts[i]->setting_info);
+                g_assert(g_hash_table_add(dup, (gpointer) info->valid_parts[i]->setting_info));
+
+                if (i == 0) {
+                    g_assert(info->valid_parts[i]->setting_info
+                             == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]);
+                    g_assert(info->valid_parts[i]->mandatory);
+                }
+                if (i == 1) {
+                    g_assert(info->valid_parts[i]->setting_info
+                             == &nm_meta_setting_infos_editor[m]);
+                    g_assert(info->valid_parts[i]->mandatory);
+                }
+            }
+            g_assert(i == l);
+        }
+    }
+
+    for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
+        const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
+
+        g_assert(nm_meta_setting_info_editor_find_by_name(info->general->setting_name, FALSE)
+                 == info);
+        g_assert(nm_meta_setting_info_editor_find_by_gtype(info->general->get_setting_gtype())
+                 == info);
+
+        for (p = 0; p < info->properties_num; p++) {
+            const NMMetaPropertyInfo *pi = info->properties[p];
+
+            g_assert(nm_meta_setting_info_editor_get_property_info(info, pi->property_name) == pi);
+            g_assert(
+                nm_meta_property_info_find_by_name(info->general->setting_name, pi->property_name)
+                == pi);
+        }
+    }
+
+    infos_p = nm_meta_setting_infos_editor_p();
+    g_assert(infos_p);
+    for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++)
+        g_assert(infos_p[m] == &nm_meta_setting_infos_editor[m]);
+    g_assert(!infos_p[m]);
 }
 
 /*****************************************************************************/
 
 static void
-test_client_import_wireguard_test0 (void)
+test_client_import_wireguard_test0(void)
 {
-	gs_unref_object NMConnection *connection;
-	NMSettingWireGuard *s_wg;
-	NMSettingIPConfig *s_ip4;
-	NMSettingIPConfig *s_ip6;
-	NMWireGuardPeer *peer;
-	gs_free_error GError *error = NULL;
-
-	connection = nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test0.conf",
-	                                      &error);
-
-	g_assert_no_error (error);
-
-	g_assert_cmpstr (nm_connection_get_id (connection), ==, "wg-test0");
-	g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "wg-test0");
-	g_assert_cmpstr (nm_connection_get_connection_type (connection), ==, NM_SETTING_WIREGUARD_SETTING_NAME);
-
-	s_wg = NM_SETTING_WIREGUARD (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIREGUARD));
-
-	g_assert_cmpint (nm_setting_wireguard_get_listen_port (s_wg), ==, 51820);
-	g_assert_cmpstr (nm_setting_wireguard_get_private_key (s_wg), ==, "yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=");
-
-	g_assert_cmpint (nm_setting_wireguard_get_peers_len (s_wg), ==, 3);
-
-	peer = nm_setting_wireguard_get_peer (s_wg, 0);
-	g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=");
-	g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "192.95.5.67:1234");
-	g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 2);
-	g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.192.122.3/32");
-	g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 1, NULL), ==, "10.192.124.1/24");
-
-	peer = nm_setting_wireguard_get_peer (s_wg, 1);
-	g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "TrMvSoP4jYQlY6RIzBgbssQqY3vxI2Pi+y71lOWWXX0=");
-	g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "[2607:5300:60:6b0::c05f:543]:2468");
-	g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 2);
-	g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.192.122.4/32");
-	g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 1, NULL), ==, "192.168.0.0/16");
-
-	peer = nm_setting_wireguard_get_peer (s_wg, 2);
-	g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "gN65BkIKy1eCE9pP1wdc8ROUtkHLF2PfAqYdyYBz6EA=");
-	g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "test.wireguard.com:18981");
-	g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 1);
-	g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.10.10.230/32");
-
-	s_ip4 = nm_connection_get_setting_ip4_config (connection);
-	s_ip6 = nm_connection_get_setting_ip6_config (connection);
-
-	g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 1);
-	g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip6), ==, 0);
-
-	g_assert_cmpint (nm_setting_ip_config_get_num_dns_searches (s_ip4), ==, 1);
-	g_assert_cmpint (nm_setting_ip_config_get_num_dns_searches (s_ip6), ==, 0);
-
-	g_assert_cmpstr (nm_setting_ip_config_get_dns_search (s_ip4, 0), ==, "~");
+    gs_unref_object NMConnection *connection;
+    NMSettingWireGuard *          s_wg;
+    NMSettingIPConfig *           s_ip4;
+    NMSettingIPConfig *           s_ip6;
+    NMWireGuardPeer *             peer;
+    gs_free_error GError *error = NULL;
+
+    connection =
+        nm_vpn_wireguard_import(NM_BUILD_SRCDIR "/clients/common/tests/wg-test0.conf", &error);
+
+    g_assert_no_error(error);
+
+    g_assert_cmpstr(nm_connection_get_id(connection), ==, "wg-test0");
+    g_assert_cmpstr(nm_connection_get_interface_name(connection), ==, "wg-test0");
+    g_assert_cmpstr(nm_connection_get_connection_type(connection),
+                    ==,
+                    NM_SETTING_WIREGUARD_SETTING_NAME);
+
+    s_wg = NM_SETTING_WIREGUARD(nm_connection_get_setting(connection, NM_TYPE_SETTING_WIREGUARD));
+
+    g_assert_cmpint(nm_setting_wireguard_get_listen_port(s_wg), ==, 51820);
+    g_assert_cmpstr(nm_setting_wireguard_get_private_key(s_wg),
+                    ==,
+                    "yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=");
+
+    g_assert_cmpint(nm_setting_wireguard_get_peers_len(s_wg), ==, 3);
+
+    peer = nm_setting_wireguard_get_peer(s_wg, 0);
+    g_assert_cmpstr(nm_wireguard_peer_get_public_key(peer),
+                    ==,
+                    "xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=");
+    g_assert_cmpstr(nm_wireguard_peer_get_endpoint(peer), ==, "192.95.5.67:1234");
+    g_assert_cmpint(nm_wireguard_peer_get_allowed_ips_len(peer), ==, 2);
+    g_assert_cmpstr(nm_wireguard_peer_get_allowed_ip(peer, 0, NULL), ==, "10.192.122.3/32");
+    g_assert_cmpstr(nm_wireguard_peer_get_allowed_ip(peer, 1, NULL), ==, "10.192.124.1/24");
+
+    peer = nm_setting_wireguard_get_peer(s_wg, 1);
+    g_assert_cmpstr(nm_wireguard_peer_get_public_key(peer),
+                    ==,
+                    "TrMvSoP4jYQlY6RIzBgbssQqY3vxI2Pi+y71lOWWXX0=");
+    g_assert_cmpstr(nm_wireguard_peer_get_endpoint(peer), ==, "[2607:5300:60:6b0::c05f:543]:2468");
+    g_assert_cmpint(nm_wireguard_peer_get_allowed_ips_len(peer), ==, 2);
+    g_assert_cmpstr(nm_wireguard_peer_get_allowed_ip(peer, 0, NULL), ==, "10.192.122.4/32");
+    g_assert_cmpstr(nm_wireguard_peer_get_allowed_ip(peer, 1, NULL), ==, "192.168.0.0/16");
+
+    peer = nm_setting_wireguard_get_peer(s_wg, 2);
+    g_assert_cmpstr(nm_wireguard_peer_get_public_key(peer),
+                    ==,
+                    "gN65BkIKy1eCE9pP1wdc8ROUtkHLF2PfAqYdyYBz6EA=");
+    g_assert_cmpstr(nm_wireguard_peer_get_endpoint(peer), ==, "test.wireguard.com:18981");
+    g_assert_cmpint(nm_wireguard_peer_get_allowed_ips_len(peer), ==, 1);
+    g_assert_cmpstr(nm_wireguard_peer_get_allowed_ip(peer, 0, NULL), ==, "10.10.10.230/32");
+
+    s_ip4 = nm_connection_get_setting_ip4_config(connection);
+    s_ip6 = nm_connection_get_setting_ip6_config(connection);
+
+    g_assert_cmpint(nm_setting_ip_config_get_num_addresses(s_ip4), ==, 1);
+    g_assert_cmpint(nm_setting_ip_config_get_num_addresses(s_ip6), ==, 0);
+
+    g_assert_cmpint(nm_setting_ip_config_get_num_dns_searches(s_ip4), ==, 1);
+    g_assert_cmpint(nm_setting_ip_config_get_num_dns_searches(s_ip6), ==, 0);
+
+    g_assert_cmpstr(nm_setting_ip_config_get_dns_search(s_ip4, 0), ==, "~");
 }
 
 static void
-test_client_import_wireguard_test1 (void)
+test_client_import_wireguard_test1(void)
 {
-	gs_free_error GError *error = NULL;
+    gs_free_error GError *error = NULL;
 
-	nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test1.conf", &error);
-	g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
-	g_assert (g_str_has_prefix (error->message, "invalid secret 'PrivateKey'"));
-	g_assert (g_str_has_suffix (error->message, "wg-test1.conf:2"));
+    nm_vpn_wireguard_import(NM_BUILD_SRCDIR "/clients/common/tests/wg-test1.conf", &error);
+    g_assert_error(error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
+    g_assert(g_str_has_prefix(error->message, "invalid secret 'PrivateKey'"));
+    g_assert(g_str_has_suffix(error->message, "wg-test1.conf:2"));
 }
 
 static void
-test_client_import_wireguard_test2 (void)
+test_client_import_wireguard_test2(void)
 {
-	gs_free_error GError *error = NULL;
+    gs_free_error GError *error = NULL;
 
-	nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test2.conf", &error);
+    nm_vpn_wireguard_import(NM_BUILD_SRCDIR "/clients/common/tests/wg-test2.conf", &error);
 
-	g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
-	g_assert (g_str_has_prefix (error->message, "unrecognized line at"));
-	g_assert (g_str_has_suffix (error->message, "wg-test2.conf:5"));
+    g_assert_error(error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
+    g_assert(g_str_has_prefix(error->message, "unrecognized line at"));
+    g_assert(g_str_has_suffix(error->message, "wg-test2.conf:5"));
 }
 
 static void
-test_client_import_wireguard_test3 (void)
+test_client_import_wireguard_test3(void)
 {
-	gs_free_error GError *error = NULL;
+    gs_free_error GError *error = NULL;
 
-	nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test3.conf", &error);
-	g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
-	g_assert (g_str_has_prefix (error->message, "invalid value for 'ListenPort'"));
-	g_assert (g_str_has_suffix (error->message, "wg-test3.conf:3"));
+    nm_vpn_wireguard_import(NM_BUILD_SRCDIR "/clients/common/tests/wg-test3.conf", &error);
+    g_assert_error(error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
+    g_assert(g_str_has_prefix(error->message, "invalid value for 'ListenPort'"));
+    g_assert(g_str_has_suffix(error->message, "wg-test3.conf:3"));
 }
 
 static void
-test_client_import_wireguard_missing (void)
+test_client_import_wireguard_missing(void)
 {
-	gs_free_error GError *error = NULL;
+    gs_free_error GError *error = NULL;
 
-	nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-missing.conf", &error);
-	g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
+    nm_vpn_wireguard_import(NM_BUILD_SRCDIR "/clients/common/tests/wg-missing.conf", &error);
+    g_assert_error(error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
 }
 
 /*****************************************************************************/
 
-#define _do_test_parse_passwd_file(contents, success, exp_error_line, ...) \
-	G_STMT_START { \
-		static const NMUtilsNamedValue _values[] = { \
-			__VA_ARGS__ \
-		}; \
-		gs_free char *_contents = g_strndup (contents, NM_STRLEN (contents)); \
-		gs_unref_hashtable GHashTable *_secrets = NULL; \
-		gs_free_error GError *_local = NULL; \
-		gssize _error_line; \
-		GError **_p_local = nmtst_get_rand_bool () ? &_local : NULL; \
-		gssize *_p_error_line = nmtst_get_rand_bool () ? &_error_line : NULL; \
-		gboolean _success = !!(success); \
-		gssize _exp_error_line = (exp_error_line); \
-		int _i; \
-		\
-		g_assert (_success || (G_N_ELEMENTS (_values) == 0)); \
-		\
-		_secrets = nmc_utils_parse_passwd_file (_contents, _p_error_line, _p_local); \
-		\
-		g_assert (_success == (!!_secrets)); \
-		if (!_success) { \
-			if (_p_error_line) \
-				g_assert_cmpint (_exp_error_line, ==, *_p_error_line); \
-			if (_p_local) \
-				g_assert (_local); \
-		} else { \
-			if (_p_error_line) \
-				g_assert_cmpint (-1, ==, *_p_error_line); \
-			g_assert (!_local); \
-			\
-			for (_i = 0; _i < G_N_ELEMENTS (_values); _i++) { \
-				const NMUtilsNamedValue *_n = &_values[_i]; \
-				const char *_v; \
-				\
-				_v = g_hash_table_lookup (_secrets, _n->name); \
-				if (!_v) \
-					g_error ("cannot find key \"%s\"", _n->name); \
-				g_assert_cmpstr (_v, ==, _n->value_str); \
-			} \
-			\
-			g_assert_cmpint (g_hash_table_size (_secrets), ==, G_N_ELEMENTS (_values)); \
-		} \
-	} G_STMT_END
-
-#define _do_test_parse_passwd_file_bad( contents, exp_error_line) _do_test_parse_passwd_file (contents, FALSE, exp_error_line)
-#define _do_test_parse_passwd_file_good(contents, ...)            _do_test_parse_passwd_file (contents, TRUE,  -1, __VA_ARGS__)
+#define _do_test_parse_passwd_file(contents, success, exp_error_line, ...)                   \
+    G_STMT_START                                                                             \
+    {                                                                                        \
+        static const NMUtilsNamedValue _values[] = {__VA_ARGS__};                            \
+        gs_free char *                 _contents = g_strndup(contents, NM_STRLEN(contents)); \
+        gs_unref_hashtable GHashTable *_secrets  = NULL;                                     \
+        gs_free_error GError *_local             = NULL;                                     \
+        gssize                _error_line;                                                   \
+        GError **             _p_local        = nmtst_get_rand_bool() ? &_local : NULL;      \
+        gssize *              _p_error_line   = nmtst_get_rand_bool() ? &_error_line : NULL; \
+        gboolean              _success        = !!(success);                                 \
+        gssize                _exp_error_line = (exp_error_line);                            \
+        int                   _i;                                                            \
+                                                                                             \
+        g_assert(_success || (G_N_ELEMENTS(_values) == 0));                                  \
+                                                                                             \
+        _secrets = nmc_utils_parse_passwd_file(_contents, _p_error_line, _p_local);          \
+                                                                                             \
+        g_assert(_success == (!!_secrets));                                                  \
+        if (!_success) {                                                                     \
+            if (_p_error_line)                                                               \
+                g_assert_cmpint(_exp_error_line, ==, *_p_error_line);                        \
+            if (_p_local)                                                                    \
+                g_assert(_local);                                                            \
+        } else {                                                                             \
+            if (_p_error_line)                                                               \
+                g_assert_cmpint(-1, ==, *_p_error_line);                                     \
+            g_assert(!_local);                                                               \
+                                                                                             \
+            for (_i = 0; _i < G_N_ELEMENTS(_values); _i++) {                                 \
+                const NMUtilsNamedValue *_n = &_values[_i];                                  \
+                const char *             _v;                                                 \
+                                                                                             \
+                _v = g_hash_table_lookup(_secrets, _n->name);                                \
+                if (!_v)                                                                     \
+                    g_error("cannot find key \"%s\"", _n->name);                             \
+                g_assert_cmpstr(_v, ==, _n->value_str);                                      \
+            }                                                                                \
+                                                                                             \
+            g_assert_cmpint(g_hash_table_size(_secrets), ==, G_N_ELEMENTS(_values));         \
+        }                                                                                    \
+    }                                                                                        \
+    G_STMT_END
+
+#define _do_test_parse_passwd_file_bad(contents, exp_error_line) \
+    _do_test_parse_passwd_file(contents, FALSE, exp_error_line)
+#define _do_test_parse_passwd_file_good(contents, ...) \
+    _do_test_parse_passwd_file(contents, TRUE, -1, __VA_ARGS__)
 
 static void
-test_nmc_utils_parse_passwd_file (void)
+test_nmc_utils_parse_passwd_file(void)
 {
-	_do_test_parse_passwd_file_good ("");
-	_do_test_parse_passwd_file_bad ("x", 1);
-	_do_test_parse_passwd_file_bad ("\r\rx", 3);
-	_do_test_parse_passwd_file_good ("wifi.psk=abc",
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk", "abc") );
-	_do_test_parse_passwd_file_good ("wifi.psk:ABC\r"
-	                                 "wifi-sec.psk = abc ",
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk", "abc") );
-	_do_test_parse_passwd_file_good ("wifi.psk:  abc\r"
-	                                 "wifi-sec.psk2 = d\\145f\r\n"
-	                                 "  wifi.psk3 = e\\  \n"
-	                                 "  #wifi-sec.psk2 = \r\n"
-	                                 "  wifi-sec.psk4:",
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk",  "abc"),
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk2", "def"),
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk3", "e "),
-	                                 NM_UTILS_NAMED_VALUE_INIT ("802-11-wireless-security.psk4", "") );
+    _do_test_parse_passwd_file_good("");
+    _do_test_parse_passwd_file_bad("x", 1);
+    _do_test_parse_passwd_file_bad("\r\rx", 3);
+    _do_test_parse_passwd_file_good(
+        "wifi.psk=abc",
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk", "abc"));
+    _do_test_parse_passwd_file_good(
+        "wifi.psk:ABC\r"
+        "wifi-sec.psk = abc ",
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk", "abc"));
+    _do_test_parse_passwd_file_good(
+        "wifi.psk:  abc\r"
+        "wifi-sec.psk2 = d\\145f\r\n"
+        "  wifi.psk3 = e\\  \n"
+        "  #wifi-sec.psk2 = \r\n"
+        "  wifi-sec.psk4:",
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk", "abc"),
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk2", "def"),
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk3", "e "),
+        NM_UTILS_NAMED_VALUE_INIT("802-11-wireless-security.psk4", ""));
 }
 
 /*****************************************************************************/
 
-NMTST_DEFINE ();
+NMTST_DEFINE();
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
-	nmtst_init (&argc, &argv, TRUE);
+    nmtst_init(&argc, &argv, TRUE);
 
-	g_test_add_func ("/client/meta/check", test_client_meta_check);
-	g_test_add_func ("/client/import/wireguard/test0", test_client_import_wireguard_test0);
-	g_test_add_func ("/client/import/wireguard/test1", test_client_import_wireguard_test1);
-	g_test_add_func ("/client/import/wireguard/test2", test_client_import_wireguard_test2);
-	g_test_add_func ("/client/import/wireguard/test3", test_client_import_wireguard_test3);
-	g_test_add_func ("/client/import/wireguard/missing", test_client_import_wireguard_missing);
-	g_test_add_func ("/client/test_nmc_utils_parse_passwd_file", test_nmc_utils_parse_passwd_file);
+    g_test_add_func("/client/meta/check", test_client_meta_check);
+    g_test_add_func("/client/import/wireguard/test0", test_client_import_wireguard_test0);
+    g_test_add_func("/client/import/wireguard/test1", test_client_import_wireguard_test1);
+    g_test_add_func("/client/import/wireguard/test2", test_client_import_wireguard_test2);
+    g_test_add_func("/client/import/wireguard/test3", test_client_import_wireguard_test3);
+    g_test_add_func("/client/import/wireguard/missing", test_client_import_wireguard_missing);
+    g_test_add_func("/client/test_nmc_utils_parse_passwd_file", test_nmc_utils_parse_passwd_file);
 
-	return g_test_run ();
+    return g_test_run();
 }
diff --git a/clients/common/tests/test-libnm-core-aux.c b/clients/common/tests/test-libnm-core-aux.c
index 7acbc6e1..5b2b38fd 100644
--- a/clients/common/tests/test-libnm-core-aux.c
+++ b/clients/common/tests/test-libnm-core-aux.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2019 Red Hat, Inc.
  */
@@ -13,224 +13,238 @@
 /*****************************************************************************/
 
 static NMTeamLinkWatcher *
-_team_link_watcher_from_string_impl (const char *str, gsize nextra, const char *const*vextra)
+_team_link_watcher_from_string_impl(const char *str, gsize nextra, const char *const *vextra)
 {
-	NMTeamLinkWatcher *watcher;
-	gs_free char *str1_free = NULL;
-	gs_free_error GError *error = NULL;
-	gsize i;
-
-	g_assert (str);
-
-	watcher = nm_utils_team_link_watcher_from_string (str, &error);
-	nmtst_assert_success (watcher, error);
-
-	for (i = 0; i < 1 + nextra; i++) {
-		nm_auto_unref_team_link_watcher NMTeamLinkWatcher *watcher1 = NULL;
-		const char *str1;
-
-		if (i == 0) {
-			str1_free = nm_utils_team_link_watcher_to_string (watcher);
-			g_assert (str1_free);
-			str1 = str1_free;
-			g_assert_cmpstr (str, ==, str1);
-		} else
-			str1 = vextra[i - 1];
-
-		watcher1 = nm_utils_team_link_watcher_from_string (str1, &error);
-		nmtst_assert_success (watcher1, error);
-		if (!nm_team_link_watcher_equal (watcher, watcher1)) {
-			gs_free char *ss1 = NULL;
-			gs_free char *ss2 = NULL;
-
-			g_print (">>> watcher differs: \"%s\" vs. \"%s\"",
-			         (ss1 = nm_utils_team_link_watcher_to_string (watcher)),
-			         (ss2 = nm_utils_team_link_watcher_to_string (watcher1)));
-			g_print (">>> ORIG: \"%s\" vs. \"%s\"", str, str1);
-			g_assert_not_reached ();
-		}
-		g_assert (nm_team_link_watcher_equal (watcher1, watcher));
-	}
-
-	return watcher;
+    NMTeamLinkWatcher *watcher;
+    gs_free char *     str1_free = NULL;
+    gs_free_error GError *error  = NULL;
+    gsize                 i;
+
+    g_assert(str);
+
+    watcher = nm_utils_team_link_watcher_from_string(str, &error);
+    nmtst_assert_success(watcher, error);
+
+    for (i = 0; i < 1 + nextra; i++) {
+        nm_auto_unref_team_link_watcher NMTeamLinkWatcher *watcher1 = NULL;
+        const char *                                       str1;
+
+        if (i == 0) {
+            str1_free = nm_utils_team_link_watcher_to_string(watcher);
+            g_assert(str1_free);
+            str1 = str1_free;
+            g_assert_cmpstr(str, ==, str1);
+        } else
+            str1 = vextra[i - 1];
+
+        watcher1 = nm_utils_team_link_watcher_from_string(str1, &error);
+        nmtst_assert_success(watcher1, error);
+        if (!nm_team_link_watcher_equal(watcher, watcher1)) {
+            gs_free char *ss1 = NULL;
+            gs_free char *ss2 = NULL;
+
+            g_print(">>> watcher differs: \"%s\" vs. \"%s\"",
+                    (ss1 = nm_utils_team_link_watcher_to_string(watcher)),
+                    (ss2 = nm_utils_team_link_watcher_to_string(watcher1)));
+            g_print(">>> ORIG: \"%s\" vs. \"%s\"", str, str1);
+            g_assert_not_reached();
+        }
+        g_assert(nm_team_link_watcher_equal(watcher1, watcher));
+    }
+
+    return watcher;
 }
 #define _team_link_watcher_from_string(str, ...) \
-	_team_link_watcher_from_string_impl ((str), NM_NARG (__VA_ARGS__), NM_MAKE_STRV (__VA_ARGS__))
+    _team_link_watcher_from_string_impl((str), NM_NARG(__VA_ARGS__), NM_MAKE_STRV(__VA_ARGS__))
 
 /*****************************************************************************/
 
 static void
-test_team_link_watcher_tofro_string (void)
+test_team_link_watcher_tofro_string(void)
 {
-	nm_auto_unref_team_link_watcher NMTeamLinkWatcher *w = NULL;
-
-#define _team_link_watcher_cmp(watcher, \
-                               name, \
-                               delay_down, \
-                               delay_up, \
-                               init_wait, \
-                               interval, \
-                               missed_max, \
-                               target_host, \
-                               source_host, \
-                               vlanid, \
-                               arping_flags) \
-	G_STMT_START { \
-		nm_auto_unref_team_link_watcher NMTeamLinkWatcher *_w = g_steal_pointer (watcher); \
-		\
-		g_assert_cmpstr ((name),         ==, nm_team_link_watcher_get_name (_w)); \
-		g_assert_cmpint ((delay_down),   ==, nm_team_link_watcher_get_delay_down (_w)); \
-		g_assert_cmpint ((delay_up),     ==, nm_team_link_watcher_get_delay_up (_w)); \
-		g_assert_cmpint ((init_wait),    ==, nm_team_link_watcher_get_init_wait (_w)); \
-		g_assert_cmpint ((interval),     ==, nm_team_link_watcher_get_interval (_w)); \
-		g_assert_cmpint ((missed_max),   ==, nm_team_link_watcher_get_missed_max (_w)); \
-		g_assert_cmpstr ((target_host),  ==, nm_team_link_watcher_get_target_host (_w)); \
-		g_assert_cmpstr ((source_host),  ==, nm_team_link_watcher_get_source_host (_w)); \
-		g_assert_cmpint ((vlanid),       ==, nm_team_link_watcher_get_vlanid (_w)); \
-		g_assert_cmpint ((arping_flags), ==, nm_team_link_watcher_get_flags (_w)); \
-	} G_STMT_END
-
-	w = _team_link_watcher_from_string ("name=ethtool",
-	                                    "delay-up=0   name=ethtool",
-	                                    "  delay-down=0   name=ethtool   ");
-	_team_link_watcher_cmp (&w,
-	                        "ethtool",
-	                        0,
-	                        0,
-	                        -1,
-	                        -1,
-	                        -1,
-	                        NULL,
-	                        NULL,
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=ethtool delay-up=10",
-	                                    "   delay-down=0  delay-up=10   name=ethtool");
-	_team_link_watcher_cmp (&w,
-	                        "ethtool",
-	                        0,
-	                        10,
-	                        -1,
-	                        -1,
-	                        -1,
-	                        NULL,
-	                        NULL,
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=ethtool delay-up=10 delay-down=11",
-	                                    "   delay-down=11  delay-up=10   name=ethtool");
-	_team_link_watcher_cmp (&w,
-	                        "ethtool",
-	                        11,
-	                        10,
-	                        -1,
-	                        -1,
-	                        -1,
-	                        NULL,
-	                        NULL,
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=nsna_ping target-host=xxx",
-	                                    "name=nsna_ping target-host=xxx",
-	                                    "  missed-max=3    target-host=xxx        name=nsna_ping   ");
-	_team_link_watcher_cmp (&w,
-	                        "nsna_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        3,
-	                        "xxx",
-	                        NULL,
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd",
-	                                    "  source-host=yzd target-host=xxx        name=arp_ping   ");
-	_team_link_watcher_cmp (&w,
-	                        "arp_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        3,
-	                        "xxx",
-	                        "yzd",
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
-	_team_link_watcher_cmp (&w,
-	                        "arp_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        0,
-	                        "xxx",
-	                        "yzd",
-	                        0,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
-
-	w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd validate-active=true",
-	                                    "source-host=yzd send-always=false name=arp_ping validate-active=true validate-inactive=false target-host=xxx",
-	                                    "  source-host=yzd target-host=xxx   validate-active=true      name=arp_ping   ");
-	_team_link_watcher_cmp (&w,
-	                        "arp_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        3,
-	                        "xxx",
-	                        "yzd",
-	                        -1,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE);
-
-	w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd validate-active=true validate-inactive=true send-always=true",
-	                                    "source-host=yzd send-always=true name=arp_ping validate-active=true validate-inactive=true target-host=xxx",
-	                                    "source-host=yzd send-always=true name=arp_ping validate-active=1 validate-inactive=yes target-host=xxx",
-	                                    "  source-host=yzd target-host=xxx   validate-inactive=true send-always=true    validate-active=true      name=arp_ping   ");
-	_team_link_watcher_cmp (&w,
-	                        "arp_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        3,
-	                        "xxx",
-	                        "yzd",
-	                        -1,
-	                          NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE
-	                        | NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE
-	                        | NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS);
-
-	w = _team_link_watcher_from_string ("name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
-	_team_link_watcher_cmp (&w,
-	                        "arp_ping",
-	                        -1,
-	                        -1,
-	                        0,
-	                        0,
-	                        0,
-	                        "xxx",
-	                        "yzd",
-	                        0,
-	                        NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+    nm_auto_unref_team_link_watcher NMTeamLinkWatcher *w = NULL;
+
+#define _team_link_watcher_cmp(watcher,                                                   \
+                               name,                                                      \
+                               delay_down,                                                \
+                               delay_up,                                                  \
+                               init_wait,                                                 \
+                               interval,                                                  \
+                               missed_max,                                                \
+                               target_host,                                               \
+                               source_host,                                               \
+                               vlanid,                                                    \
+                               arping_flags)                                              \
+    G_STMT_START                                                                          \
+    {                                                                                     \
+        nm_auto_unref_team_link_watcher NMTeamLinkWatcher *_w = g_steal_pointer(watcher); \
+                                                                                          \
+        g_assert_cmpstr((name), ==, nm_team_link_watcher_get_name(_w));                   \
+        g_assert_cmpint((delay_down), ==, nm_team_link_watcher_get_delay_down(_w));       \
+        g_assert_cmpint((delay_up), ==, nm_team_link_watcher_get_delay_up(_w));           \
+        g_assert_cmpint((init_wait), ==, nm_team_link_watcher_get_init_wait(_w));         \
+        g_assert_cmpint((interval), ==, nm_team_link_watcher_get_interval(_w));           \
+        g_assert_cmpint((missed_max), ==, nm_team_link_watcher_get_missed_max(_w));       \
+        g_assert_cmpstr((target_host), ==, nm_team_link_watcher_get_target_host(_w));     \
+        g_assert_cmpstr((source_host), ==, nm_team_link_watcher_get_source_host(_w));     \
+        g_assert_cmpint((vlanid), ==, nm_team_link_watcher_get_vlanid(_w));               \
+        g_assert_cmpint((arping_flags), ==, nm_team_link_watcher_get_flags(_w));          \
+    }                                                                                     \
+    G_STMT_END
+
+    w = _team_link_watcher_from_string("name=ethtool",
+                                       "delay-up=0   name=ethtool",
+                                       "  delay-down=0   name=ethtool   ");
+    _team_link_watcher_cmp(&w,
+                           "ethtool",
+                           0,
+                           0,
+                           -1,
+                           -1,
+                           -1,
+                           NULL,
+                           NULL,
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string("name=ethtool delay-up=10",
+                                       "   delay-down=0  delay-up=10   name=ethtool");
+    _team_link_watcher_cmp(&w,
+                           "ethtool",
+                           0,
+                           10,
+                           -1,
+                           -1,
+                           -1,
+                           NULL,
+                           NULL,
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string("name=ethtool delay-up=10 delay-down=11",
+                                       "   delay-down=11  delay-up=10   name=ethtool");
+    _team_link_watcher_cmp(&w,
+                           "ethtool",
+                           11,
+                           10,
+                           -1,
+                           -1,
+                           -1,
+                           NULL,
+                           NULL,
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string(
+        "name=nsna_ping target-host=xxx",
+        "name=nsna_ping target-host=xxx",
+        "  missed-max=3    target-host=xxx        name=nsna_ping   ");
+    _team_link_watcher_cmp(&w,
+                           "nsna_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           3,
+                           "xxx",
+                           NULL,
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string("name=arp_ping target-host=xxx source-host=yzd",
+                                       "  source-host=yzd target-host=xxx        name=arp_ping   ");
+    _team_link_watcher_cmp(&w,
+                           "arp_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           3,
+                           "xxx",
+                           "yzd",
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string(
+        "name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
+    _team_link_watcher_cmp(&w,
+                           "arp_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           0,
+                           "xxx",
+                           "yzd",
+                           0,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
+
+    w = _team_link_watcher_from_string(
+        "name=arp_ping target-host=xxx source-host=yzd validate-active=true",
+        "source-host=yzd send-always=false name=arp_ping validate-active=true "
+        "validate-inactive=false target-host=xxx",
+        "  source-host=yzd target-host=xxx   validate-active=true      name=arp_ping   ");
+    _team_link_watcher_cmp(&w,
+                           "arp_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           3,
+                           "xxx",
+                           "yzd",
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE);
+
+    w = _team_link_watcher_from_string(
+        "name=arp_ping target-host=xxx source-host=yzd validate-active=true validate-inactive=true "
+        "send-always=true",
+        "source-host=yzd send-always=true name=arp_ping validate-active=true "
+        "validate-inactive=true target-host=xxx",
+        "source-host=yzd send-always=true name=arp_ping validate-active=1 validate-inactive=yes "
+        "target-host=xxx",
+        "  source-host=yzd target-host=xxx   validate-inactive=true send-always=true    "
+        "validate-active=true      name=arp_ping   ");
+    _team_link_watcher_cmp(&w,
+                           "arp_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           3,
+                           "xxx",
+                           "yzd",
+                           -1,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE
+                               | NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE
+                               | NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS);
+
+    w = _team_link_watcher_from_string(
+        "name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
+    _team_link_watcher_cmp(&w,
+                           "arp_ping",
+                           -1,
+                           -1,
+                           0,
+                           0,
+                           0,
+                           "xxx",
+                           "yzd",
+                           0,
+                           NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
 }
 
 /*****************************************************************************/
 
-NMTST_DEFINE ();
+NMTST_DEFINE();
 
-int main (int argc, char **argv)
+int
+main(int argc, char **argv)
 {
-	nmtst_init (&argc, &argv, TRUE);
+    nmtst_init(&argc, &argv, TRUE);
 
-	g_test_add_func ("/libnm-core-aux/test_team_link_watcher_tofro_string", test_team_link_watcher_tofro_string);
+    g_test_add_func("/libnm-core-aux/test_team_link_watcher_tofro_string",
+                    test_team_link_watcher_tofro_string);
 
-	return g_test_run ();
+    return g_test_run();
 }