summaryrefslogtreecommitdiff
path: root/gir
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2010-04-23 16:32:08 +0200
committerTomeu Vizoso <tomeu@sugarlabs.org>2010-04-23 16:32:08 +0200
commit95b9f1832daee474d439f680d80a6538649e7aef (patch)
treec2793e5b5b874930c239dbcf0070760c522d1502 /gir
parent781db9e3967604e234be28f178617ed275fa60aa (diff)
downloadgobject-introspection-95b9f1832daee474d439f680d80a6538649e7aef.tar.gz
Add tests for unions
Diffstat (limited to 'gir')
-rw-r--r--gir/gimarshallingtests.c97
-rw-r--r--gir/gimarshallingtests.h15
2 files changed, 112 insertions, 0 deletions
diff --git a/gir/gimarshallingtests.c b/gir/gimarshallingtests.c
index 5f09633b..cf509a79 100644
--- a/gir/gimarshallingtests.c
+++ b/gir/gimarshallingtests.c
@@ -2503,6 +2503,103 @@ g_i_marshalling_tests__boxed_struct_inout (GIMarshallingTestsBoxedStruct **struc
(*struct_)->long_ = 0;
}
+static GIMarshallingTestsUnion *
+g_i_marshalling_tests_union_copy (GIMarshallingTestsUnion *union_)
+{
+ GIMarshallingTestsUnion *new_union;
+
+ new_union = g_slice_new (GIMarshallingTestsUnion);
+
+ *new_union = *union_;
+
+ return new_union;
+}
+
+static void
+g_i_marshalling_tests_union_free (GIMarshallingTestsUnion *union_)
+{
+ g_slice_free (GIMarshallingTestsUnion, union_);
+}
+
+GType
+g_i_marshalling_tests_union_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ type = g_boxed_type_register_static ("GIMarshallingTestsUnion",
+ (GBoxedCopyFunc) g_i_marshalling_tests_union_copy,
+ (GBoxedFreeFunc) g_i_marshalling_tests_union_free);
+ }
+
+ return type;
+}
+
+/**
+ * g_i_marshalling_tests__union_return:
+ * Returns: (transfer none):
+ */
+GIMarshallingTestsUnion *
+g_i_marshalling_tests__union_return (void)
+{
+ static GIMarshallingTestsUnion *union_ = NULL;
+
+ if (union_ == NULL) {
+ union_ = g_new(GIMarshallingTestsUnion, 1);
+
+ union_->long_ = 42;
+ }
+
+ return union_;
+}
+
+/**
+ * g_i_marshalling_tests__union_in:
+ * @union_: (transfer none):
+ */
+void
+g_i_marshalling_tests__union_in (GIMarshallingTestsUnion *union_)
+{
+ g_assert(union_->long_ == 42);
+}
+
+/**
+ * g_i_marshalling_tests__union_out:
+ * @union_: (out) (transfer none):
+ */
+void
+g_i_marshalling_tests__union_out (GIMarshallingTestsUnion **union_)
+{
+ static GIMarshallingTestsUnion *new_union = NULL;
+
+ if (new_union == NULL) {
+ new_union = g_new(GIMarshallingTestsUnion, 1);
+
+ new_union->long_ = 42;
+ }
+
+ *union_ = new_union;
+}
+
+/**
+ * g_i_marshalling_tests__union_inout:
+ * @union_: (inout) (transfer none):
+ */
+void
+g_i_marshalling_tests__union_inout (GIMarshallingTestsUnion **union_)
+{
+ g_assert((*union_)->long_ == 42);
+
+ (*union_)->long_ = 0;
+}
+
+void
+g_i_marshalling_tests_union_method (GIMarshallingTestsUnion *union_)
+{
+ g_assert(union_->long_ == 42);
+}
+
+
enum
{
diff --git a/gir/gimarshallingtests.h b/gir/gimarshallingtests.h
index b38c9c9c..678ab360 100644
--- a/gir/gimarshallingtests.h
+++ b/gir/gimarshallingtests.h
@@ -497,6 +497,21 @@ void g_i_marshalling_tests__boxed_struct_out (GIMarshallingTestsBoxedStruct **st
void g_i_marshalling_tests__boxed_struct_inout (GIMarshallingTestsBoxedStruct **struct_);
+typedef union {
+ glong long_;
+} GIMarshallingTestsUnion;
+
+GType g_i_marshalling_tests_union_get_type (void) G_GNUC_CONST;
+
+GIMarshallingTestsUnion *g_i_marshalling_tests__union_return (void);
+
+void g_i_marshalling_tests__union_in (GIMarshallingTestsUnion *union_);
+
+void g_i_marshalling_tests__union_out (GIMarshallingTestsUnion **union_);
+
+void g_i_marshalling_tests__union_inout (GIMarshallingTestsUnion **union_);
+
+void g_i_marshalling_tests_union_method (GIMarshallingTestsUnion *union_);
/* Object */