From: Rico Tzschichholz Date: Mon, 9 May 2022 08:14:51 +0000 (+0200) Subject: update tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec92ea481de1235e6462179cb4fbf5d6dd82ced9;p=thirdparty%2Fvala.git update tests --- diff --git a/tests/basic-types/arrays-move-with-class.c-expected b/tests/basic-types/arrays-move-with-class.c-expected index b9ca5ba8f..66da9ceb9 100644 --- a/tests/basic-types/arrays-move-with-class.c-expected +++ b/tests/basic-types/arrays-move-with-class.c-expected @@ -3,7 +3,6 @@ #include #include -#include #include #if !defined(VALA_EXTERN) @@ -16,73 +15,45 @@ #endif #endif -#define TYPE_TEST_DESTRUCTOR_CALLS (test_destructor_calls_get_type ()) -#define TEST_DESTRUCTOR_CALLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCalls)) -#define TEST_DESTRUCTOR_CALLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCallsClass)) -#define IS_TEST_DESTRUCTOR_CALLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_DESTRUCTOR_CALLS)) -#define IS_TEST_DESTRUCTOR_CALLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_DESTRUCTOR_CALLS)) -#define TEST_DESTRUCTOR_CALLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCallsClass)) - -typedef struct _TestDestructorCalls TestDestructorCalls; -typedef struct _TestDestructorCallsClass TestDestructorCallsClass; -typedef struct _TestDestructorCallsPrivate TestDestructorCallsPrivate; -typedef struct _ParamSpecTestDestructorCalls ParamSpecTestDestructorCalls; -#define _test_destructor_calls_unref0(var) ((var == NULL) ? NULL : (var = (test_destructor_calls_unref (var), NULL))) +#define TYPE_FOO (foo_get_type ()) +#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) +#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) +#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO)) +#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO)) +#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass)) + +typedef struct _Foo Foo; +typedef struct _FooClass FooClass; +typedef struct _FooPrivate FooPrivate; +enum { + FOO_0_PROPERTY, + FOO_NUM_PROPERTIES +}; +static GParamSpec* foo_properties[FOO_NUM_PROPERTIES]; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); -struct _TestDestructorCalls { - GTypeInstance parent_instance; - volatile int ref_count; - TestDestructorCallsPrivate * priv; -}; - -struct _TestDestructorCallsClass { - GTypeClass parent_class; - void (*finalize) (TestDestructorCalls *self); -}; - -struct _TestDestructorCallsPrivate { - gint idx; +struct _Foo { + GObject parent_instance; + FooPrivate * priv; }; -struct _ParamSpecTestDestructorCalls { - GParamSpec parent_instance; +struct _FooClass { + GObjectClass parent_class; }; -static gint TestDestructorCalls_private_offset; -static gpointer test_destructor_calls_parent_class = NULL; -VALA_EXTERN gint test_destructor_calls_destructor_calls; -gint test_destructor_calls_destructor_calls = 0; +static gpointer foo_parent_class = NULL; -VALA_EXTERN gpointer test_destructor_calls_ref (gpointer instance); -VALA_EXTERN void test_destructor_calls_unref (gpointer instance); -VALA_EXTERN GParamSpec* param_spec_test_destructor_calls (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags); -VALA_EXTERN void value_set_test_destructor_calls (GValue* value, - gpointer v_object); -VALA_EXTERN void value_take_test_destructor_calls (GValue* value, - gpointer v_object); -VALA_EXTERN gpointer value_get_test_destructor_calls (const GValue* value); -VALA_EXTERN GType test_destructor_calls_get_type (void) G_GNUC_CONST ; -G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestDestructorCalls, test_destructor_calls_unref) -VALA_EXTERN TestDestructorCalls* test_destructor_calls_new (gint idx); -VALA_EXTERN TestDestructorCalls* test_destructor_calls_construct (GType object_type, - gint idx); -static void test_destructor_calls_finalize (TestDestructorCalls * obj); -static GType test_destructor_calls_get_type_once (void); -VALA_EXTERN void test_array_with_classes_move (gint src, - gint dest, - gint count, - gint expected_destructor_calls); -VALA_EXTERN void test_unowned_array_move (gint src, - gint dest, - gint count); +VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; +G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) +VALA_EXTERN Foo* foo_new (void); +VALA_EXTERN Foo* foo_construct (GType object_type); +static GType foo_get_type_once (void); +VALA_EXTERN void test_array_with_class_move (void); +VALA_EXTERN void test_unowned_array_with_class_move (void); static void _vala_main (void); static void _vala_array_destroy (gpointer array, gssize array_length, @@ -97,364 +68,146 @@ static void _vala_array_move (gpointer array, gssize dest, gssize length); -static inline gpointer -test_destructor_calls_get_instance_private (TestDestructorCalls* self) +Foo* +foo_construct (GType object_type) { - return G_STRUCT_MEMBER_P (self, TestDestructorCalls_private_offset); -} - -TestDestructorCalls* -test_destructor_calls_construct (GType object_type, - gint idx) -{ - TestDestructorCalls* self = NULL; - self = (TestDestructorCalls*) g_type_create_instance (object_type); - self->priv->idx = idx; + Foo * self = NULL; + self = (Foo*) g_object_new (object_type, NULL); return self; } -TestDestructorCalls* -test_destructor_calls_new (gint idx) +Foo* +foo_new (void) { - return test_destructor_calls_construct (TYPE_TEST_DESTRUCTOR_CALLS, idx); + return foo_construct (TYPE_FOO); } static void -value_test_destructor_calls_init (GValue* value) +foo_class_init (FooClass * klass, + gpointer klass_data) { - value->data[0].v_pointer = NULL; + foo_parent_class = g_type_class_peek_parent (klass); } static void -value_test_destructor_calls_free_value (GValue* value) -{ - if (value->data[0].v_pointer) { - test_destructor_calls_unref (value->data[0].v_pointer); - } -} - -static void -value_test_destructor_calls_copy_value (const GValue* src_value, - GValue* dest_value) -{ - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = test_destructor_calls_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - -static gpointer -value_test_destructor_calls_peek_pointer (const GValue* value) +foo_instance_init (Foo * self, + gpointer klass) { - return value->data[0].v_pointer; -} - -static gchar* -value_test_destructor_calls_collect_value (GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ - if (collect_values[0].v_pointer) { - TestDestructorCalls * object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = test_destructor_calls_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - -static gchar* -value_test_destructor_calls_lcopy_value (const GValue* value, - guint n_collect_values, - GTypeCValue* collect_values, - guint collect_flags) -{ - TestDestructorCalls ** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = test_destructor_calls_ref (value->data[0].v_pointer); - } - return NULL; -} - -GParamSpec* -param_spec_test_destructor_calls (const gchar* name, - const gchar* nick, - const gchar* blurb, - GType object_type, - GParamFlags flags) -{ - ParamSpecTestDestructorCalls* spec; - g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_DESTRUCTOR_CALLS), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - -gpointer -value_get_test_destructor_calls (const GValue* value) -{ - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS), NULL); - return value->data[0].v_pointer; -} - -void -value_set_test_destructor_calls (GValue* value, - gpointer v_object) -{ - TestDestructorCalls * old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DESTRUCTOR_CALLS)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - test_destructor_calls_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_destructor_calls_unref (old); - } -} - -void -value_take_test_destructor_calls (GValue* value, - gpointer v_object) -{ - TestDestructorCalls * old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DESTRUCTOR_CALLS)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DESTRUCTOR_CALLS)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - test_destructor_calls_unref (old); - } -} - -static void -test_destructor_calls_class_init (TestDestructorCallsClass * klass, - gpointer klass_data) -{ - test_destructor_calls_parent_class = g_type_class_peek_parent (klass); - ((TestDestructorCallsClass *) klass)->finalize = test_destructor_calls_finalize; - g_type_class_adjust_private_offset (klass, &TestDestructorCalls_private_offset); -} - -static void -test_destructor_calls_instance_init (TestDestructorCalls * self, - gpointer klass) -{ - self->priv = test_destructor_calls_get_instance_private (self); - self->ref_count = 1; -} - -static void -test_destructor_calls_finalize (TestDestructorCalls * obj) -{ - TestDestructorCalls * self; - gint _tmp0_; - self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_DESTRUCTOR_CALLS, TestDestructorCalls); - g_signal_handlers_destroy (self); - _tmp0_ = test_destructor_calls_destructor_calls; - test_destructor_calls_destructor_calls = _tmp0_ + 1; } static GType -test_destructor_calls_get_type_once (void) +foo_get_type_once (void) { - static const GTypeValueTable g_define_type_value_table = { value_test_destructor_calls_init, value_test_destructor_calls_free_value, value_test_destructor_calls_copy_value, value_test_destructor_calls_peek_pointer, "p", value_test_destructor_calls_collect_value, "p", value_test_destructor_calls_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (TestDestructorCallsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_destructor_calls_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestDestructorCalls), 0, (GInstanceInitFunc) test_destructor_calls_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - GType test_destructor_calls_type_id; - test_destructor_calls_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestDestructorCalls", &g_define_type_info, &g_define_type_fundamental_info, 0); - TestDestructorCalls_private_offset = g_type_add_instance_private (test_destructor_calls_type_id, sizeof (TestDestructorCallsPrivate)); - return test_destructor_calls_type_id; + static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, NULL }; + GType foo_type_id; + foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0); + return foo_type_id; } GType -test_destructor_calls_get_type (void) +foo_get_type (void) { - static volatile gsize test_destructor_calls_type_id__once = 0; - if (g_once_init_enter (&test_destructor_calls_type_id__once)) { - GType test_destructor_calls_type_id; - test_destructor_calls_type_id = test_destructor_calls_get_type_once (); - g_once_init_leave (&test_destructor_calls_type_id__once, test_destructor_calls_type_id); + static volatile gsize foo_type_id__once = 0; + if (g_once_init_enter (&foo_type_id__once)) { + GType foo_type_id; + foo_type_id = foo_get_type_once (); + g_once_init_leave (&foo_type_id__once, foo_type_id); } - return test_destructor_calls_type_id__once; -} - -gpointer -test_destructor_calls_ref (gpointer instance) -{ - TestDestructorCalls * self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; + return foo_type_id__once; } -void -test_destructor_calls_unref (gpointer instance) +static gpointer +_g_object_ref0 (gpointer self) { - TestDestructorCalls * self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - TEST_DESTRUCTOR_CALLS_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } + return self ? g_object_ref (self) : NULL; } void -test_array_with_classes_move (gint src, - gint dest, - gint count, - gint expected_destructor_calls) -{ - static const gint arr_size = 5; - TestDestructorCalls** arr = NULL; - TestDestructorCalls** _tmp0_; - gint arr_length1; - gint _arr_size_; - test_destructor_calls_destructor_calls = 0; - _tmp0_ = g_new0 (TestDestructorCalls*, arr_size + 1); - arr = _tmp0_; - arr_length1 = arr_size; - _arr_size_ = arr_length1; - { - gint i = 0; - i = 0; - { - gboolean _tmp1_ = FALSE; - _tmp1_ = TRUE; - while (TRUE) { - TestDestructorCalls** _tmp3_; - gint _tmp3__length1; - TestDestructorCalls* _tmp4_; - if (!_tmp1_) { - gint _tmp2_; - _tmp2_ = i; - i = _tmp2_ + 1; - } - _tmp1_ = FALSE; - if (!(i < arr_size)) { - break; - } - _tmp3_ = arr; - _tmp3__length1 = arr_length1; - _tmp4_ = test_destructor_calls_new (i); - _test_destructor_calls_unref0 (_tmp3_[i]); - _tmp3_[i] = _tmp4_; - } - } - } - _vala_array_move (arr, sizeof (TestDestructorCalls*), test_destructor_calls_unref, src, dest, count); - _vala_assert (test_destructor_calls_destructor_calls == expected_destructor_calls, "TestDestructorCalls.destructor_calls == expected_destructor_calls"); - arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) test_destructor_calls_unref), NULL); -} - -static gpointer -_test_destructor_calls_ref0 (gpointer self) +test_array_with_class_move (void) { - return self ? test_destructor_calls_ref (self) : NULL; + Foo* foo = NULL; + Foo* _tmp0_; + Foo** a = NULL; + Foo* _tmp1_; + Foo* _tmp2_; + Foo* _tmp3_; + Foo* _tmp4_; + Foo* _tmp5_; + Foo* _tmp6_; + Foo* _tmp7_; + Foo* _tmp8_; + Foo* _tmp9_; + Foo** _tmp10_; + gint a_length1; + gint _a_size_; + _tmp0_ = foo_new (); + foo = _tmp0_; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1"); + _tmp1_ = _g_object_ref0 (foo); + _tmp2_ = _g_object_ref0 (foo); + _tmp3_ = _g_object_ref0 (foo); + _tmp4_ = _g_object_ref0 (foo); + _tmp5_ = _g_object_ref0 (foo); + _tmp6_ = _g_object_ref0 (foo); + _tmp7_ = _g_object_ref0 (foo); + _tmp8_ = _g_object_ref0 (foo); + _tmp9_ = _g_object_ref0 (foo); + _tmp10_ = g_new0 (Foo*, 9 + 1); + _tmp10_[0] = _tmp1_; + _tmp10_[1] = _tmp2_; + _tmp10_[2] = _tmp3_; + _tmp10_[3] = _tmp4_; + _tmp10_[4] = _tmp5_; + _tmp10_[5] = _tmp6_; + _tmp10_[6] = _tmp7_; + _tmp10_[7] = _tmp8_; + _tmp10_[8] = _tmp9_; + a = _tmp10_; + a_length1 = 9; + _a_size_ = a_length1; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 10), "foo.ref_count == 10"); + _vala_array_move (a, sizeof (Foo*), g_object_unref, 0, 2, 3); + a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_object_unref), NULL); + _g_object_unref0 (foo); } void -test_unowned_array_move (gint src, - gint dest, - gint count) +test_unowned_array_with_class_move (void) { - static const gint arr_size = 5; - TestDestructorCalls** arr = NULL; - TestDestructorCalls** _tmp0_; - gint arr_length1; - gint _arr_size_; - TestDestructorCalls** owner = NULL; - TestDestructorCalls** _tmp1_; - gint owner_length1; - gint _owner_size_; - test_destructor_calls_destructor_calls = 0; - _tmp0_ = g_new0 (TestDestructorCalls*, arr_size + 1); - arr = _tmp0_; - arr_length1 = arr_size; - _arr_size_ = arr_length1; - _tmp1_ = g_new0 (TestDestructorCalls*, arr_size + 1); - owner = _tmp1_; - owner_length1 = arr_size; - _owner_size_ = owner_length1; - { - gint i = 0; - i = 0; - { - gboolean _tmp2_ = FALSE; - _tmp2_ = TRUE; - while (TRUE) { - TestDestructorCalls* obj = NULL; - TestDestructorCalls* _tmp4_; - TestDestructorCalls** _tmp5_; - gint _tmp5__length1; - TestDestructorCalls* _tmp6_; - TestDestructorCalls* _tmp7_; - TestDestructorCalls** _tmp8_; - gint _tmp8__length1; - TestDestructorCalls* _tmp9_; - if (!_tmp2_) { - gint _tmp3_; - _tmp3_ = i; - i = _tmp3_ + 1; - } - _tmp2_ = FALSE; - if (!(i < arr_size)) { - break; - } - _tmp4_ = test_destructor_calls_new (i); - obj = _tmp4_; - _tmp5_ = owner; - _tmp5__length1 = owner_length1; - _tmp6_ = obj; - _tmp7_ = _test_destructor_calls_ref0 (_tmp6_); - _test_destructor_calls_unref0 (_tmp5_[i]); - _tmp5_[i] = _tmp7_; - _tmp8_ = arr; - _tmp8__length1 = arr_length1; - _tmp9_ = obj; - _tmp8_[i] = _tmp9_; - _test_destructor_calls_unref0 (obj); - } - } - } - _vala_array_move (arr, sizeof (TestDestructorCalls*), NULL, src, dest, count); - _vala_assert (test_destructor_calls_destructor_calls == 0, "TestDestructorCalls.destructor_calls == 0"); - owner = (_vala_array_free (owner, owner_length1, (GDestroyNotify) test_destructor_calls_unref), NULL); - arr = (g_free (arr), NULL); + Foo* foo = NULL; + Foo* _tmp0_; + Foo** a = NULL; + Foo** _tmp1_; + gint a_length1; + gint _a_size_; + _tmp0_ = foo_new (); + foo = _tmp0_; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1"); + _tmp1_ = g_new0 (Foo*, 9 + 1); + _tmp1_[0] = foo; + _tmp1_[1] = foo; + _tmp1_[2] = foo; + _tmp1_[3] = foo; + _tmp1_[4] = foo; + _tmp1_[5] = foo; + _tmp1_[6] = foo; + _tmp1_[7] = foo; + _tmp1_[8] = foo; + a = _tmp1_; + a_length1 = 9; + _a_size_ = a_length1; + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1"); + _vala_array_move (a, sizeof (Foo*), NULL, 0, 2, 3); + _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), "foo.ref_count == 1"); + a = (g_free (a), NULL); + _g_object_unref0 (foo); } static void _vala_main (void) { - test_array_with_classes_move (0, 2, 3, 1); - test_array_with_classes_move (2, 0, 3, 2); - test_array_with_classes_move (0, 3, 1, 1); - test_unowned_array_move (3, 0, 1); + test_array_with_class_move (); + test_unowned_array_with_class_move (); } int diff --git a/tests/basic-types/arrays-move-with-class.vala b/tests/basic-types/arrays-move-with-class.vala index c01d10623..ed0867620 100644 --- a/tests/basic-types/arrays-move-with-class.vala +++ b/tests/basic-types/arrays-move-with-class.vala @@ -1,48 +1,27 @@ -class TestDestructorCalls { - public static int destructor_calls = 0; - private int idx; - - public TestDestructorCalls (int idx) { this.idx = idx; } - - ~TestDestructorCalls () { destructor_calls++; } +class Foo : Object { } -void test_array_with_classes_move (int src, int dest, int count, int expected_destructor_calls) -{ - const int arr_size = 5; - TestDestructorCalls.destructor_calls = 0; - TestDestructorCalls[] arr = new TestDestructorCalls[arr_size]; - for(int i=0; i