diff options
author | Johan Dahlin <jdahlin@async.com.br> | 2008-11-14 11:37:29 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-11-14 11:37:29 +0000 |
commit | 795aa75e9cad4d3dcc77e1d5daf9cd5b68bb2360 (patch) | |
tree | 52329181dd600ebb7065cbeb937c5e802a37a7fb | |
parent | 1019350c01273da7dd893f90e44e539d374fb519 (diff) | |
download | gobject-introspection-795aa75e9cad4d3dcc77e1d5daf9cd5b68bb2360.tar.gz |
Rename the int/gtype array tests. Make the return value useful, an
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
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | tests/everything/everything.c | 37 | ||||
-rw-r--r-- | tests/everything/everything.h | 4 |
3 files changed, 36 insertions, 13 deletions
@@ -1,5 +1,13 @@ 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: * tests/everything/everything.c: * tests/everything/everything.h: diff --git a/tests/everything/everything.c b/tests/everything/everything.c index 3f005325..6441e930 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 fd99924f..d173ac3f 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 */ |