qulogic/gplugin

449f104ae6a2
Parents 67f2e5aa5b99
Children 0974d38256c0
Clean up indentation and make this test easier to follow
--- a/gplugin/tests/test-plugin-info.c Tue Jan 22 23:18:33 2019 -0600
+++ b/gplugin/tests/test-plugin-info.c Sun Jan 27 00:33:19 2019 -0600
@@ -42,18 +42,26 @@
test_stringv(gchar **got, const gchar * const * const expected,
TestStringVFunc func, GPluginPluginInfo *info)
{
- gint i = 0;
- gchar **tmp = NULL;
+ gint i = 0;
+ gchar **tmp = NULL;
- for(i = 0; expected[i]; i++)
- g_assert_cmpstr(got[i], ==, expected[i]);
+ /* make sure our arrarys are the same length */
+ g_assert_cmpuint(g_strv_length(got), ==, g_strv_length(expected));
+
+ /* now walk through until expected[i] is null comparing each entry */
+ for(i = 0; expected[i]; i++)
+ g_assert_cmpstr(got[i], ==, expected[i]);
- tmp = func(info);
+ /* call the accessor on the GPluginPluginInfo object */
+ tmp = func(info);
- for(i = 0; got[i]; i++)
- g_assert_cmpstr(got[i], ==, tmp[i]);
+ /* verify that the accessor returned the proper value as well */
+ g_assert_cmpuint(g_strv_length(tmp), ==, g_strv_length(expected));
- g_strfreev(tmp);
+ for(i = 0; expected[i]; i++)
+ g_assert_cmpstr(tmp[i], ==, expected[i]);
+
+ g_strfreev(tmp);
}
/******************************************************************************