[gobject-introspection] A few transfer-related tests for "Everything"
- From: Andreas Rottmann <rotty src gnome org>
- To: svn-commits-list gnome org
- Subject: [gobject-introspection] A few transfer-related tests for "Everything"
- Date: Fri, 29 May 2009 16:41:04 -0400 (EDT)
commit 3e6a539a2f6c9d9b9e0f314077b1e49f07834560
Author: Andreas Rottmann <a rottmann gmx at>
Date: Fri May 29 22:35:07 2009 +0200
A few transfer-related tests for "Everything"
---
tests/everything/everything.c | 45 +++++++++++++++++++++++++++++++++++++++++
tests/everything/everything.h | 7 ++++++
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/tests/everything/everything.c b/tests/everything/everything.c
index 52dec4b..f2a2e30 100644
--- a/tests/everything/everything.c
+++ b/tests/everything/everything.c
@@ -325,6 +325,10 @@ test_array_gint64_in (int n_ints, gint64 *ints)
return sum;
}
+/**
+ * test_strv_in:
+ * @arr: (array zero-terminated=1) (transfer none):
+ */
gboolean
test_strv_in (char **arr)
{
@@ -340,6 +344,18 @@ test_strv_in (char **arr)
}
/**
+ * test_strv_in_container:
+ * @arr: (array zero-terminated=1) (transfer container):
+ */
+gboolean
+test_strv_in_container (char **arr)
+{
+ gboolean result = test_strv_in (arr);
+ g_free (arr);
+ return result;
+}
+
+/**
* test_array_gtype_in:
* @n_types:
* @types: (array length=n_types): List of types
@@ -378,6 +394,35 @@ test_strv_out (void)
}
/**
+ * test_strv_outarg:
+ * @retp: (array zero-terminated=1) (out) (transfer container):
+ */
+void
+test_strv_outarg (char ***retp)
+{
+ char **ret = g_new (char *, 4);
+ ret[0] = "1";
+ ret[1] = "2";
+ ret[2] = "3";
+ ret[3] = NULL;
+ *retp = ret;
+}
+
+/**
+ * test_array_int_in_take:
+ * @n_ints:
+ * @ints: (array length=n_ints) (transfer full): List of ints
+ */
+int test_array_int_in_take (int n_ints, int *ints)
+{
+ int i, sum = 0;
+ for (i = 0; i < n_ints; i++)
+ sum += ints[i];
+ g_free (ints);
+ return sum;
+}
+
+/**
* test_array_int_full_out:
* @len: length of the returned array.
* Returns: (array length=len) (transfer full): a new array of integers.
diff --git a/tests/everything/everything.h b/tests/everything/everything.h
index 2a7e3cd..a4120dc 100644
--- a/tests/everything/everything.h
+++ b/tests/everything/everything.h
@@ -44,8 +44,15 @@ gint32 test_array_gint32_in (int n_ints, gint32 *ints);
gint64 test_array_gint64_in (int n_ints, gint64 *ints);
char *test_array_gtype_in (int n_types, GType *types);
char **test_strv_out (void);
+void test_strv_outarg (char ***retp);
+
+/* transfer tests */
+int test_array_int_in_take (int n_ints, int *ints);
+gboolean test_strv_in_container (char **arr);
+
int *test_array_int_full_out(int *len);
int *test_array_int_none_out(int *len);
+
/* interface */
/* GList */
G_CONST_RETURN GList *test_glist_nothing_return (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]