gobject-introspection r924 - in trunk: . tests/everything



Author: johan
Date: Fri Nov 14 11:37:29 2008
New Revision: 924
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=924&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/tests/everything/everything.c
   trunk/tests/everything/everything.h

Modified: trunk/tests/everything/everything.c
==============================================================================
--- trunk/tests/everything/everything.c	(original)
+++ trunk/tests/everything/everything.c	Fri Nov 14 11:37:29 2008
@@ -157,15 +157,19 @@
 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_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 **

Modified: trunk/tests/everything/everything.h
==============================================================================
--- trunk/tests/everything/everything.h	(original)
+++ trunk/tests/everything/everything.h	Fri Nov 14 11:37:29 2008
@@ -36,8 +36,8 @@
 /* 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]