From: Johan Dahlin Date: Fri, 14 Nov 2008 11:37:29 +0000 (+0000) Subject: Rename the int/gtype array tests. Make the return value useful, an X-Git-Tag: GOBJECT_INTROSPECTION_0_6_1~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=795aa75e9cad4d3dcc77e1d5daf9cd5b68bb2360;p=platform%2Fupstream%2Fgobject-introspection.git Rename the int/gtype array tests. Make the return value useful, an 2008-11-14 Johan Dahlin * 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 --- diff --git a/ChangeLog b/ChangeLog index 3ca3979..a0c972d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-11-14 Johan Dahlin + * 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 + * tests/everything/Makefile.am: * tests/everything/everything.c: * tests/everything/everything.h: diff --git a/tests/everything/everything.c b/tests/everything/everything.c index 3f00532..6441e93 100644 --- a/tests/everything/everything.c +++ b/tests/everything/everything.c @@ -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 ** diff --git a/tests/everything/everything.h b/tests/everything/everything.h index fd99924..d173ac3 100644 --- a/tests/everything/everything.h +++ b/tests/everything/everything.h @@ -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 */