Rename the int/gtype array tests. Make the return value useful, an
authorJohan Dahlin <jdahlin@async.com.br>
Fri, 14 Nov 2008 11:37:29 +0000 (11:37 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Fri, 14 Nov 2008 11:37:29 +0000 (11:37 +0000)
2008-11-14  Johan Dahlin  <jdahlin@async.com.br>

    * tests/everything/everything.c (test_array_int_in),
    (test_array_gtype_in):
    * tests/everything/everything.h:
    Rename the int/gtype array tests. Make the return value
    useful, an aggregation of the array input values.

svn path=/trunk/; revision=924

ChangeLog
tests/everything/everything.c
tests/everything/everything.h

index 3ca3979..a0c972d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-14  Johan Dahlin  <jdahlin@async.com.br>
+
+       * tests/everything/everything.c (test_array_int_in),
+       (test_array_gtype_in):
+       * tests/everything/everything.h:
+       Rename the int/gtype array tests. Make the return value
+       useful, an aggregation of the array input values.
+
 2008-11-14  Johan Dahlin  <jdahlin@async.com.br>
 
        * tests/everything/Makefile.am:
index 3f00532..6441e93 100644 (file)
@@ -157,15 +157,19 @@ GSList *test_filename_return (void)
 static const char *test_sequence[] = {"1", "2", "3"};
 
 /* array */
+
 /**
- * test_int_in:
- * @n_types: 
- * @types: (array length=n_types): List of ints
+ * test_array_int_in:
+ * @n_ints: 
+ * @ints: (array length=n_ints): List of ints
  */
 int
-test_int_in (int n_types, int *types)
+test_array_int_in (int n_ints, int *ints)
 {
-  return n_types;
+  int i, sum = 0;
+  for (i = 0; i < n_ints; i++)
+    sum += ints[i];
+  return sum;
 }
 
 gboolean
@@ -183,14 +187,25 @@ test_strv_in (char **arr)
 }
 
 /**
- * test_gtype_in:
+ * test_array_gtype_in:
  * @n_types: 
  * @types: (array length=n_types): List of types
- */
-int
-test_gtype_in (int n_types, GType *types)
-{
-  return n_types;
+ * Return value: string representation of provided types
+ * */
+const char *
+test_array_gtype_in (int n_types, GType *types)
+{
+  GString *string;
+  int i;
+
+  string = g_string_new ("[");
+  for (i = 0; i < n_types; i++)
+    {
+      g_string_append (string, g_type_name (types[i]));
+      g_string_append_c (string, ',');
+    }
+  g_string_append_c (string, ']');
+  return g_string_free (string, FALSE);
 }
 
 char **
index fd99924..d173ac3 100644 (file)
@@ -36,8 +36,8 @@ GSList *test_filename_return (void);
 /* non-basic-types */
 /* array */
 gboolean test_strv_in (char **arr);
-int test_int_in (int n_types, int *types);
-int test_gtype_in (int n_types, GType *types);
+int test_array_int_in (int n_ints, int *ints);
+const char *test_array_gtype_in (int n_types, GType *types);
 char **test_strv_out (void);
 /* interface */
 /* GList */