diff options
Diffstat (limited to 'src/tests/test-wired-defname.c')
| -rw-r--r-- | src/tests/test-wired-defname.c | 26 |
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); |