summary refs log tree commit diff
path: root/src/tests/test-wired-defname.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-08-26 02:18:32 +0200
committerMichael Biebl <biebl@debian.org>2016-08-26 02:18:32 +0200
commit7514efc2f38c9ace4557d4e69d68e7d380389030 (patch)
tree7fb00fda86cfcc2ca377f191633a7cfdbfea7ca3 /src/tests/test-wired-defname.c
parentd6201f5d8daada3d64a0a3e0038e14eebec683ce (diff)
Imported Upstream version 1.4.0 upstream/1.4.0
Diffstat (limited to 'src/tests/test-wired-defname.c')
-rw-r--r--src/tests/test-wired-defname.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c
index 6edd5ff2..3ae3a19d 100644
--- a/src/tests/test-wired-defname.c
+++ b/src/tests/test-wired-defname.c
@@ -24,7 +24,7 @@
 #include "nm-setting-connection.h"
 #include "nm-device-ethernet-utils.h"
 
-#include "nm-test-utils.h"
+#include "nm-test-utils-core.h"
 
 static NMConnection *
 _new_connection (const char *id)
@@ -41,12 +41,28 @@ _new_connection (const char *id)
 
 /*******************************************/
 
+static char *
+_get_default_wired_name (GSList *list)
+{
+	gs_free NMConnection **v = NULL;
+	guint l, i;
+
+	l = g_slist_length (list);
+	v = g_new0 (NMConnection *, l + 1);
+	for (i = 0; list; list = list->next, i++)
+		v[i] = NM_CONNECTION (list->data);
+	g_assert (i == l);
+	return nm_device_ethernet_utils_get_default_wired_name (v);
+}
+
+/*******************************************/
+
 static void
 test_defname_no_connections (void)
 {
 	gs_free char *name = NULL;
 
-	name = nm_device_ethernet_utils_get_default_wired_name (NULL);
+	name = _get_default_wired_name (NULL);
 	g_assert_cmpstr (name, ==, "Wired connection 1");
 }
 
@@ -62,7 +78,7 @@ test_defname_no_conflict (void)
 	list = g_slist_append (list, _new_connection ("work wifi"));
 	list = g_slist_append (list, _new_connection ("random gsm connection"));
 
-	name = nm_device_ethernet_utils_get_default_wired_name (list);
+	name = _get_default_wired_name (list);
 	g_assert_cmpstr (name, ==, "Wired connection 1");
 
 	g_slist_free_full (list, g_object_unref);
@@ -80,7 +96,7 @@ test_defname_conflict (void)
 	list = g_slist_append (list, _new_connection ("Wired connection 1"));
 	list = g_slist_append (list, _new_connection ("random gsm connection"));
 
-	name = nm_device_ethernet_utils_get_default_wired_name (list);
+	name = _get_default_wired_name (list);
 	g_assert_cmpstr (name, ==, "Wired connection 2");
 
 	g_slist_free_full (list, g_object_unref);
@@ -102,7 +118,7 @@ test_defname_multiple_conflicts (void)
 	list = g_slist_append (list, _new_connection ("work wifi"));
 	list = g_slist_append (list, _new_connection ("a vpn"));
 
-	name = nm_device_ethernet_utils_get_default_wired_name (list);
+	name = _get_default_wired_name (list);
 	g_assert_cmpstr (name, ==, "Wired connection 4");
 
 	g_slist_free_full (list, g_object_unref);