all/tests: fix messages for ASSERT() macro
authorThomas Haller <thaller@redhat.com>
Wed, 3 Feb 2016 11:37:25 +0000 (12:37 +0100)
committerThomas Haller <thaller@redhat.com>
Wed, 3 Feb 2016 11:37:43 +0000 (12:37 +0100)
These places pass an invalid arguments for the given
format string. Fix them, by dropping the overly verbose
ASSERT() macro.

libnm-core/tests/test-setting-8021x.c
libnm-util/tests/test-setting-8021x.c
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
src/settings/plugins/ifupdown/tests/test-ifupdown.c

index 49d7448..4940401 100644 (file)
@@ -47,9 +47,7 @@ compare_blob_data (const char *test,
 
        ASSERT (len > 0, test, "blob key file invalid (size 0)");
 
-       ASSERT (len == g_bytes_get_size (key),
-               test, "blob key file (%d) and setting key data (%d) lengths don't match",
-               len, g_bytes_get_size (key));
+       g_assert_cmpint (len, ==, g_bytes_get_size (key));
 
        ASSERT (memcmp (contents, g_bytes_get_data (key, NULL), len) == 0,
                test, "blob key file and blob key data don't match");
index ad48ac6..14e1df1 100644 (file)
@@ -47,9 +47,7 @@ compare_blob_data (const char *test,
 
        ASSERT (len > 0, test, "blob key file invalid (size 0)");
 
-       ASSERT (len == key->len,
-               test, "blob key file (%d) and setting key data (%d) lengths don't match",
-               len, key->len);
+       g_assert_cmpint (len, ==, key->len);
 
        ASSERT (memcmp (contents, key->data, len) == 0,
                test, "blob key file and blob key data don't match");
index 129faeb..2e932f3 100644 (file)
@@ -1905,17 +1905,10 @@ test_read_wired_8021x_peap_mschapv2 (void)
                                                 NM_SETTING_802_1X_CK_SCHEME_PATH,
                                                 NULL,
                                                 &error);
-       ASSERT (success == TRUE,
-               "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: could not load CA certificate",
-               TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2,
-               NM_SETTING_802_1X_SETTING_NAME,
-               NM_SETTING_802_1X_CA_CERT);
+       g_assert (success == TRUE);
+
        expected_ca_cert_path = nm_setting_802_1x_get_ca_cert_path (tmp_8021x);
-       ASSERT (expected_ca_cert_path != NULL,
-               "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: failed to get CA certificate",
-               TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2,
-               NM_SETTING_802_1X_SETTING_NAME,
-               NM_SETTING_802_1X_CA_CERT);
+       g_assert (expected_ca_cert_path);
 
        read_ca_cert_path = nm_setting_802_1x_get_ca_cert_path (s_8021x);
        ASSERT (read_ca_cert_path != NULL,
@@ -7399,12 +7392,8 @@ test_write_wired_aliases (void)
                ip[j] = NULL;
        }
 
-       for (i = 0; i < num_addresses; i++) {
-               ASSERT (ip[i] == 0,
-                       "wired-aliases-write-verify-ip4", "failed to verify %s: did not find IP4 address 0x%08x",
-                       testfile,
-                       ip[i]);
-       }
+       for (i = 0; i < num_addresses; i++)
+               g_assert (!ip[i]);
 
        /* Gateway */
        g_assert_cmpstr (nm_setting_ip_config_get_gateway (s_ip4), ==, "1.1.1.1");
index 24e8afd..f9aedf4 100644 (file)
@@ -628,9 +628,7 @@ test18_read_static_ipv6 (const char *path)
        connection = nm_simple_connection_new();
        ifupdown_update_connection_from_if_block(connection, block, &error);
 
-       ASSERT (connection != NULL,
-                       TEST18_NAME
-                       "failed to read %s: %s", file, error->message);
+       g_assert (connection != NULL);
 
        ASSERT (nm_connection_verify (connection, &error),
                        TEST18_NAME,