423396e1ed018a31b348fb6c649216fbd835d9c7
[profile/ivi/libgee.git] / tests / testarraylist.c
1 /* testarraylist.c generated by valac 0.18.0, the Vala compiler
2  * generated from testarraylist.vala, do not modify */
3
4 /* testarraylist.vala
5  *
6  * Copyright (C) 2008  Jürg Billeter
7  * Copyright (C) 2009  Didier Villevalois, Julien Peeters
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
22  *
23  * Author:
24  *      Jürg Billeter <j@bitron.ch>
25  *      Didier 'Ptitjes Villevalois <ptitjes@free.fr>
26  *      Julien Peeters <contact@julienpeeters.fr>
27  */
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include <gee.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <float.h>
35 #include <math.h>
36
37
38 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
39 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
40 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
41 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
42 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
43 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
44
45 typedef struct _GeeTestCase GeeTestCase;
46 typedef struct _GeeTestCaseClass GeeTestCaseClass;
47 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
48
49 #define TYPE_COLLECTION_TESTS (collection_tests_get_type ())
50 #define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests))
51 #define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass))
52 #define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS))
53 #define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS))
54 #define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass))
55
56 typedef struct _CollectionTests CollectionTests;
57 typedef struct _CollectionTestsClass CollectionTestsClass;
58 typedef struct _CollectionTestsPrivate CollectionTestsPrivate;
59
60 #define TYPE_LIST_TESTS (list_tests_get_type ())
61 #define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests))
62 #define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass))
63 #define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS))
64 #define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS))
65 #define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass))
66
67 typedef struct _ListTests ListTests;
68 typedef struct _ListTestsClass ListTestsClass;
69 typedef struct _ListTestsPrivate ListTestsPrivate;
70
71 #define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ())
72 #define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests))
73 #define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass))
74 #define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS))
75 #define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS))
76 #define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass))
77
78 typedef struct _ArrayListTests ArrayListTests;
79 typedef struct _ArrayListTestsClass ArrayListTestsClass;
80 typedef struct _ArrayListTestsPrivate ArrayListTestsPrivate;
81 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
82 #define _g_free0(var) (var = (g_free (var), NULL))
83 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
84
85 struct _GeeTestCase {
86         GObject parent_instance;
87         GeeTestCasePrivate * priv;
88 };
89
90 struct _GeeTestCaseClass {
91         GObjectClass parent_class;
92         void (*set_up) (GeeTestCase* self);
93         void (*tear_down) (GeeTestCase* self);
94 };
95
96 struct _CollectionTests {
97         GeeTestCase parent_instance;
98         CollectionTestsPrivate * priv;
99         GeeCollection* test_collection;
100 };
101
102 struct _CollectionTestsClass {
103         GeeTestCaseClass parent_class;
104 };
105
106 struct _ListTests {
107         CollectionTests parent_instance;
108         ListTestsPrivate * priv;
109 };
110
111 struct _ListTestsClass {
112         CollectionTestsClass parent_class;
113         void (*test_duplicates_are_retained) (ListTests* self);
114 };
115
116 struct _ArrayListTests {
117         ListTests parent_instance;
118         ArrayListTestsPrivate * priv;
119 };
120
121 struct _ArrayListTestsClass {
122         ListTestsClass parent_class;
123 };
124
125 typedef void (*GeeTestCaseTestMethod) (void* user_data);
126
127 static gpointer array_list_tests_parent_class = NULL;
128
129 GType gee_test_case_get_type (void) G_GNUC_CONST;
130 GType collection_tests_get_type (void) G_GNUC_CONST;
131 GType list_tests_get_type (void) G_GNUC_CONST;
132 GType array_list_tests_get_type (void) G_GNUC_CONST;
133 enum  {
134         ARRAY_LIST_TESTS_DUMMY_PROPERTY
135 };
136 #define ARRAY_LIST_TESTS_BIG_SORT_SIZE 1000000
137 ArrayListTests* array_list_tests_new (void);
138 ArrayListTests* array_list_tests_construct (GType object_type);
139 ListTests* list_tests_construct (GType object_type, const gchar* name);
140 void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target);
141 void array_list_tests_test_selected_functions (ArrayListTests* self);
142 static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self);
143 void array_list_tests_test_gobject_properties (ArrayListTests* self);
144 static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self);
145 static void array_list_tests_test_small_sort (ArrayListTests* self);
146 static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self);
147 static void array_list_tests_test_big_sort (ArrayListTests* self);
148 static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self);
149 static void array_list_tests_test_typed_to_array (ArrayListTests* self);
150 static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self);
151 static void array_list_tests_real_set_up (GeeTestCase* base);
152 static void array_list_tests_real_tear_down (GeeTestCase* base);
153 static gdouble* _double_dup (gdouble* self);
154 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
155 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
156
157
158 static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) {
159         array_list_tests_test_selected_functions (self);
160 }
161
162
163 static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) {
164         array_list_tests_test_gobject_properties (self);
165 }
166
167
168 static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self) {
169         array_list_tests_test_small_sort (self);
170 }
171
172
173 static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self) {
174         array_list_tests_test_big_sort (self);
175 }
176
177
178 static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self) {
179         array_list_tests_test_typed_to_array (self);
180 }
181
182
183 ArrayListTests* array_list_tests_construct (GType object_type) {
184         ArrayListTests * self = NULL;
185         self = (ArrayListTests*) list_tests_construct (object_type, "ArrayList");
186         gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] selected functions", _array_list_tests_test_selected_functions_gee_test_case_test_method, self);
187         gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] GObject properties", _array_list_tests_test_gobject_properties_gee_test_case_test_method, self);
188         gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] small sort (insertion)", _array_list_tests_test_small_sort_gee_test_case_test_method, self);
189         gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] big sort (timsort)", _array_list_tests_test_big_sort_gee_test_case_test_method, self);
190         gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] typed to_array calls", _array_list_tests_test_typed_to_array_gee_test_case_test_method, self);
191         return self;
192 }
193
194
195 ArrayListTests* array_list_tests_new (void) {
196         return array_list_tests_construct (TYPE_ARRAY_LIST_TESTS);
197 }
198
199
200 static void array_list_tests_real_set_up (GeeTestCase* base) {
201         ArrayListTests * self;
202         GeeArrayList* _tmp0_;
203         self = (ArrayListTests*) base;
204         _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
205         _g_object_unref0 (((CollectionTests*) self)->test_collection);
206         ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_;
207 }
208
209
210 static void array_list_tests_real_tear_down (GeeTestCase* base) {
211         ArrayListTests * self;
212         self = (ArrayListTests*) base;
213         _g_object_unref0 (((CollectionTests*) self)->test_collection);
214         ((CollectionTests*) self)->test_collection = NULL;
215 }
216
217
218 static gpointer _g_object_ref0 (gpointer self) {
219         return self ? g_object_ref (self) : NULL;
220 }
221
222
223 void array_list_tests_test_selected_functions (ArrayListTests* self) {
224         GeeCollection* _tmp0_;
225         GeeArrayList* _tmp1_;
226         GeeArrayList* test_list;
227         GEqualFunc _tmp2_;
228         GEqualFunc _tmp3_;
229         GEqualFunc _tmp4_;
230         g_return_if_fail (self != NULL);
231         _tmp0_ = ((CollectionTests*) self)->test_collection;
232         _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL);
233         test_list = _tmp1_;
234         _vala_assert (test_list != NULL, "test_list != null");
235         _tmp2_ = gee_array_list_get_equal_func (test_list);
236         _tmp3_ = _tmp2_;
237         _tmp4_ = g_str_equal;
238         _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal");
239         _g_object_unref0 (test_list);
240 }
241
242
243 void array_list_tests_test_gobject_properties (ArrayListTests* self) {
244         GeeCollection* _tmp0_;
245         GeeArrayList* _tmp1_;
246         GeeArrayList* test_list;
247         GValue value = {0};
248         GValue _tmp2_ = {0};
249         GValue _tmp3_;
250         void* _tmp4_ = NULL;
251         GEqualFunc _tmp5_;
252         GEqualFunc _tmp6_;
253         g_return_if_fail (self != NULL);
254         _tmp0_ = ((CollectionTests*) self)->test_collection;
255         _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL);
256         test_list = _tmp1_;
257         _vala_assert (test_list != NULL, "test_list != null");
258         g_value_init (&_tmp2_, G_TYPE_POINTER);
259         G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
260         value = _tmp2_;
261         _tmp3_ = value;
262         g_object_get_property ((GObject*) test_list, "equal-func", &value);
263         _tmp4_ = g_value_get_pointer (&value);
264         _tmp5_ = gee_array_list_get_equal_func (test_list);
265         _tmp6_ = _tmp5_;
266         _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_list.equal_func");
267         g_value_unset (&value);
268         G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
269         _g_object_unref0 (test_list);
270 }
271
272
273 static void array_list_tests_test_small_sort (ArrayListTests* self) {
274         GeeCollection* _tmp0_;
275         GeeArrayList* _tmp1_;
276         GeeArrayList* test_list;
277         gpointer _tmp2_ = NULL;
278         gchar* _tmp3_;
279         gpointer _tmp4_ = NULL;
280         gchar* _tmp5_;
281         gpointer _tmp6_ = NULL;
282         gchar* _tmp7_;
283         gpointer _tmp8_ = NULL;
284         gchar* _tmp9_;
285         gpointer _tmp10_ = NULL;
286         gchar* _tmp11_;
287         gpointer _tmp12_ = NULL;
288         gchar* _tmp13_;
289         gpointer _tmp14_ = NULL;
290         gchar* _tmp15_;
291         gpointer _tmp16_ = NULL;
292         gchar* _tmp17_;
293         gpointer _tmp18_ = NULL;
294         gchar* _tmp19_;
295         gpointer _tmp20_ = NULL;
296         gchar* _tmp21_;
297         gpointer _tmp22_ = NULL;
298         gchar* _tmp23_;
299         gpointer _tmp24_ = NULL;
300         gchar* _tmp25_;
301         g_return_if_fail (self != NULL);
302         _tmp0_ = ((CollectionTests*) self)->test_collection;
303         _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL);
304         test_list = _tmp1_;
305         _vala_assert (test_list != NULL, "test_list != null");
306         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one");
307         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two");
308         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three");
309         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four");
310         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five");
311         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six");
312         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven");
313         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight");
314         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine");
315         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten");
316         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven");
317         gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve");
318         gee_list_sort ((GeeList*) test_list, NULL);
319         _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0);
320         _tmp3_ = (gchar*) _tmp2_;
321         _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\"");
322         _g_free0 (_tmp3_);
323         _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1);
324         _tmp5_ = (gchar*) _tmp4_;
325         _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\"");
326         _g_free0 (_tmp5_);
327         _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2);
328         _tmp7_ = (gchar*) _tmp6_;
329         _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\"");
330         _g_free0 (_tmp7_);
331         _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3);
332         _tmp9_ = (gchar*) _tmp8_;
333         _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\"");
334         _g_free0 (_tmp9_);
335         _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4);
336         _tmp11_ = (gchar*) _tmp10_;
337         _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\"");
338         _g_free0 (_tmp11_);
339         _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5);
340         _tmp13_ = (gchar*) _tmp12_;
341         _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\"");
342         _g_free0 (_tmp13_);
343         _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6);
344         _tmp15_ = (gchar*) _tmp14_;
345         _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\"");
346         _g_free0 (_tmp15_);
347         _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7);
348         _tmp17_ = (gchar*) _tmp16_;
349         _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\"");
350         _g_free0 (_tmp17_);
351         _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8);
352         _tmp19_ = (gchar*) _tmp18_;
353         _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\"");
354         _g_free0 (_tmp19_);
355         _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9);
356         _tmp21_ = (gchar*) _tmp20_;
357         _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\"");
358         _g_free0 (_tmp21_);
359         _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10);
360         _tmp23_ = (gchar*) _tmp22_;
361         _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\"");
362         _g_free0 (_tmp23_);
363         _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11);
364         _tmp25_ = (gchar*) _tmp24_;
365         _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\"");
366         _g_free0 (_tmp25_);
367         _g_object_unref0 (test_list);
368 }
369
370
371 static void array_list_tests_test_big_sort (ArrayListTests* self) {
372         GeeArrayList* _tmp0_;
373         GeeList* big_test_list;
374         GeeList* _tmp7_;
375         g_return_if_fail (self != NULL);
376         _tmp0_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL);
377         big_test_list = (GeeList*) _tmp0_;
378         {
379                 gint i;
380                 i = 0;
381                 {
382                         gboolean _tmp1_;
383                         _tmp1_ = TRUE;
384                         while (TRUE) {
385                                 gboolean _tmp2_;
386                                 gint _tmp4_;
387                                 GeeList* _tmp5_;
388                                 gint32 _tmp6_ = 0;
389                                 _tmp2_ = _tmp1_;
390                                 if (!_tmp2_) {
391                                         gint _tmp3_;
392                                         _tmp3_ = i;
393                                         i = _tmp3_ + 1;
394                                 }
395                                 _tmp1_ = FALSE;
396                                 _tmp4_ = i;
397                                 if (!(_tmp4_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
398                                         break;
399                                 }
400                                 _tmp5_ = big_test_list;
401                                 _tmp6_ = g_random_int_range ((gint32) 1, (gint32) (ARRAY_LIST_TESTS_BIG_SORT_SIZE - 1));
402                                 gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) _tmp6_));
403                         }
404                 }
405         }
406         _tmp7_ = big_test_list;
407         gee_list_sort (_tmp7_, NULL);
408         {
409                 gint i;
410                 i = 1;
411                 {
412                         gboolean _tmp8_;
413                         _tmp8_ = TRUE;
414                         while (TRUE) {
415                                 gboolean _tmp9_;
416                                 gint _tmp11_;
417                                 GeeList* _tmp12_;
418                                 gint _tmp13_;
419                                 gpointer _tmp14_ = NULL;
420                                 GeeList* _tmp15_;
421                                 gint _tmp16_;
422                                 gpointer _tmp17_ = NULL;
423                                 _tmp9_ = _tmp8_;
424                                 if (!_tmp9_) {
425                                         gint _tmp10_;
426                                         _tmp10_ = i;
427                                         i = _tmp10_ + 1;
428                                 }
429                                 _tmp8_ = FALSE;
430                                 _tmp11_ = i;
431                                 if (!(_tmp11_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
432                                         break;
433                                 }
434                                 _tmp12_ = big_test_list;
435                                 _tmp13_ = i;
436                                 _tmp14_ = gee_list_get (_tmp12_, _tmp13_ - 1);
437                                 _tmp15_ = big_test_list;
438                                 _tmp16_ = i;
439                                 _tmp17_ = gee_list_get (_tmp15_, _tmp16_);
440                                 _vala_assert (((gint32) ((gintptr) _tmp14_)) <= ((gint32) ((gintptr) _tmp17_)), "big_test_list[i - 1] <= big_test_list[i]");
441                         }
442                 }
443         }
444         _g_object_unref0 (big_test_list);
445 }
446
447
448 static gdouble* _double_dup (gdouble* self) {
449         gdouble* dup;
450         dup = g_new0 (gdouble, 1);
451         memcpy (dup, self, sizeof (gdouble));
452         return dup;
453 }
454
455
456 static void array_list_tests_test_typed_to_array (ArrayListTests* self) {
457         GeeArrayList* _tmp0_;
458         GeeList* bool_list;
459         GeeList* _tmp1_;
460         gboolean _tmp2_ = FALSE;
461         GeeList* _tmp3_;
462         gboolean _tmp4_ = FALSE;
463         GeeList* _tmp5_;
464         gboolean _tmp6_ = FALSE;
465         GeeList* _tmp7_;
466         gint _tmp8_ = 0;
467         gpointer* _tmp9_ = NULL;
468         gboolean* bool_array;
469         gint bool_array_length1;
470         gint _bool_array_size_;
471         gint index;
472         GeeArrayList* _tmp25_;
473         GeeList* int_list;
474         GeeList* _tmp26_;
475         gboolean _tmp27_ = FALSE;
476         GeeList* _tmp28_;
477         gboolean _tmp29_ = FALSE;
478         GeeList* _tmp30_;
479         gboolean _tmp31_ = FALSE;
480         GeeList* _tmp32_;
481         gint _tmp33_ = 0;
482         gpointer* _tmp34_ = NULL;
483         gint* int_array;
484         gint int_array_length1;
485         gint _int_array_size_;
486         GeeArrayList* _tmp50_;
487         GeeList* double_list;
488         GeeList* _tmp51_;
489         gdouble _tmp52_;
490         gboolean _tmp53_ = FALSE;
491         GeeList* _tmp54_;
492         gdouble _tmp55_;
493         gboolean _tmp56_ = FALSE;
494         GeeList* _tmp57_;
495         gdouble _tmp58_;
496         gboolean _tmp59_ = FALSE;
497         GeeList* _tmp60_;
498         gint _tmp61_ = 0;
499         gpointer* _tmp62_ = NULL;
500         gdouble** double_array;
501         gint double_array_length1;
502         gint _double_array_size_;
503         g_return_if_fail (self != NULL);
504         _tmp0_ = gee_array_list_new (G_TYPE_BOOLEAN, NULL, NULL, NULL);
505         bool_list = (GeeList*) _tmp0_;
506         _tmp1_ = bool_list;
507         _tmp2_ = gee_collection_add ((GeeCollection*) _tmp1_, (gpointer) ((gintptr) TRUE));
508         _vala_assert (_tmp2_, "bool_list.add (true)");
509         _tmp3_ = bool_list;
510         _tmp4_ = gee_collection_add ((GeeCollection*) _tmp3_, (gpointer) ((gintptr) TRUE));
511         _vala_assert (_tmp4_, "bool_list.add (true)");
512         _tmp5_ = bool_list;
513         _tmp6_ = gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) FALSE));
514         _vala_assert (_tmp6_, "bool_list.add (false)");
515         _tmp7_ = bool_list;
516         _tmp9_ = gee_collection_to_array ((GeeCollection*) _tmp7_, &_tmp8_);
517         bool_array = _tmp9_;
518         bool_array_length1 = _tmp8_;
519         _bool_array_size_ = bool_array_length1;
520         index = 0;
521         {
522                 GeeList* _tmp10_;
523                 GeeList* _tmp11_;
524                 GeeList* _element_list;
525                 GeeList* _tmp12_;
526                 gint _tmp13_;
527                 gint _tmp14_;
528                 gint _element_size;
529                 gint _element_index;
530                 _tmp10_ = bool_list;
531                 _tmp11_ = _g_object_ref0 (_tmp10_);
532                 _element_list = _tmp11_;
533                 _tmp12_ = _element_list;
534                 _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_);
535                 _tmp14_ = _tmp13_;
536                 _element_size = _tmp14_;
537                 _element_index = -1;
538                 while (TRUE) {
539                         gint _tmp15_;
540                         gint _tmp16_;
541                         gint _tmp17_;
542                         GeeList* _tmp18_;
543                         gint _tmp19_;
544                         gpointer _tmp20_ = NULL;
545                         gboolean element;
546                         gboolean _tmp21_;
547                         gboolean* _tmp22_;
548                         gint _tmp22__length1;
549                         gint _tmp23_;
550                         gboolean _tmp24_;
551                         _tmp15_ = _element_index;
552                         _element_index = _tmp15_ + 1;
553                         _tmp16_ = _element_index;
554                         _tmp17_ = _element_size;
555                         if (!(_tmp16_ < _tmp17_)) {
556                                 break;
557                         }
558                         _tmp18_ = _element_list;
559                         _tmp19_ = _element_index;
560                         _tmp20_ = gee_list_get (_tmp18_, _tmp19_);
561                         element = (gboolean) ((gintptr) _tmp20_);
562                         _tmp21_ = element;
563                         _tmp22_ = bool_array;
564                         _tmp22__length1 = bool_array_length1;
565                         _tmp23_ = index;
566                         index = _tmp23_ + 1;
567                         _tmp24_ = _tmp22_[_tmp23_];
568                         _vala_assert (_tmp21_ == _tmp24_, "element == bool_array[index++]");
569                 }
570                 _g_object_unref0 (_element_list);
571         }
572         _tmp25_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL);
573         int_list = (GeeList*) _tmp25_;
574         _tmp26_ = int_list;
575         _tmp27_ = gee_collection_add ((GeeCollection*) _tmp26_, (gpointer) ((gintptr) 1));
576         _vala_assert (_tmp27_, "int_list.add (1)");
577         _tmp28_ = int_list;
578         _tmp29_ = gee_collection_add ((GeeCollection*) _tmp28_, (gpointer) ((gintptr) 2));
579         _vala_assert (_tmp29_, "int_list.add (2)");
580         _tmp30_ = int_list;
581         _tmp31_ = gee_collection_add ((GeeCollection*) _tmp30_, (gpointer) ((gintptr) 3));
582         _vala_assert (_tmp31_, "int_list.add (3)");
583         _tmp32_ = int_list;
584         _tmp34_ = gee_collection_to_array ((GeeCollection*) _tmp32_, &_tmp33_);
585         int_array = _tmp34_;
586         int_array_length1 = _tmp33_;
587         _int_array_size_ = int_array_length1;
588         index = 0;
589         {
590                 GeeList* _tmp35_;
591                 GeeList* _tmp36_;
592                 GeeList* _element_list;
593                 GeeList* _tmp37_;
594                 gint _tmp38_;
595                 gint _tmp39_;
596                 gint _element_size;
597                 gint _element_index;
598                 _tmp35_ = int_list;
599                 _tmp36_ = _g_object_ref0 (_tmp35_);
600                 _element_list = _tmp36_;
601                 _tmp37_ = _element_list;
602                 _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_);
603                 _tmp39_ = _tmp38_;
604                 _element_size = _tmp39_;
605                 _element_index = -1;
606                 while (TRUE) {
607                         gint _tmp40_;
608                         gint _tmp41_;
609                         gint _tmp42_;
610                         GeeList* _tmp43_;
611                         gint _tmp44_;
612                         gpointer _tmp45_ = NULL;
613                         gint element;
614                         gint _tmp46_;
615                         gint* _tmp47_;
616                         gint _tmp47__length1;
617                         gint _tmp48_;
618                         gint _tmp49_;
619                         _tmp40_ = _element_index;
620                         _element_index = _tmp40_ + 1;
621                         _tmp41_ = _element_index;
622                         _tmp42_ = _element_size;
623                         if (!(_tmp41_ < _tmp42_)) {
624                                 break;
625                         }
626                         _tmp43_ = _element_list;
627                         _tmp44_ = _element_index;
628                         _tmp45_ = gee_list_get (_tmp43_, _tmp44_);
629                         element = (gint) ((gintptr) _tmp45_);
630                         _tmp46_ = element;
631                         _tmp47_ = int_array;
632                         _tmp47__length1 = int_array_length1;
633                         _tmp48_ = index;
634                         index = _tmp48_ + 1;
635                         _tmp49_ = _tmp47_[_tmp48_];
636                         _vala_assert (_tmp46_ == _tmp49_, "element == int_array[index++]");
637                 }
638                 _g_object_unref0 (_element_list);
639         }
640         _tmp50_ = gee_array_list_new (G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, g_free, NULL);
641         double_list = (GeeList*) _tmp50_;
642         _tmp51_ = double_list;
643         _tmp52_ = 1.0;
644         _tmp53_ = gee_collection_add ((GeeCollection*) _tmp51_, &_tmp52_);
645         _vala_assert (_tmp53_, "double_list.add (1.0d)");
646         _tmp54_ = double_list;
647         _tmp55_ = 1.5;
648         _tmp56_ = gee_collection_add ((GeeCollection*) _tmp54_, &_tmp55_);
649         _vala_assert (_tmp56_, "double_list.add (1.5d)");
650         _tmp57_ = double_list;
651         _tmp58_ = 2.0;
652         _tmp59_ = gee_collection_add ((GeeCollection*) _tmp57_, &_tmp58_);
653         _vala_assert (_tmp59_, "double_list.add (2.0d)");
654         _tmp60_ = double_list;
655         _tmp62_ = gee_collection_to_array ((GeeCollection*) _tmp60_, &_tmp61_);
656         double_array = _tmp62_;
657         double_array_length1 = _tmp61_;
658         _double_array_size_ = double_array_length1;
659         index = 0;
660         {
661                 GeeList* _tmp63_;
662                 GeeList* _tmp64_;
663                 GeeList* _element_list;
664                 GeeList* _tmp65_;
665                 gint _tmp66_;
666                 gint _tmp67_;
667                 gint _element_size;
668                 gint _element_index;
669                 _tmp63_ = double_list;
670                 _tmp64_ = _g_object_ref0 (_tmp63_);
671                 _element_list = _tmp64_;
672                 _tmp65_ = _element_list;
673                 _tmp66_ = gee_collection_get_size ((GeeCollection*) _tmp65_);
674                 _tmp67_ = _tmp66_;
675                 _element_size = _tmp67_;
676                 _element_index = -1;
677                 while (TRUE) {
678                         gint _tmp68_;
679                         gint _tmp69_;
680                         gint _tmp70_;
681                         GeeList* _tmp71_;
682                         gint _tmp72_;
683                         gpointer _tmp73_ = NULL;
684                         gdouble* _tmp74_;
685                         gdouble _tmp75_;
686                         gdouble element;
687                         gdouble _tmp76_;
688                         gdouble** _tmp77_;
689                         gint _tmp77__length1;
690                         gint _tmp78_;
691                         gdouble* _tmp79_;
692                         _tmp68_ = _element_index;
693                         _element_index = _tmp68_ + 1;
694                         _tmp69_ = _element_index;
695                         _tmp70_ = _element_size;
696                         if (!(_tmp69_ < _tmp70_)) {
697                                 break;
698                         }
699                         _tmp71_ = _element_list;
700                         _tmp72_ = _element_index;
701                         _tmp73_ = gee_list_get (_tmp71_, _tmp72_);
702                         _tmp74_ = (gdouble*) _tmp73_;
703                         _tmp75_ = *_tmp74_;
704                         _g_free0 (_tmp74_);
705                         element = _tmp75_;
706                         _tmp76_ = element;
707                         _tmp77_ = double_array;
708                         _tmp77__length1 = double_array_length1;
709                         _tmp78_ = index;
710                         index = _tmp78_ + 1;
711                         _tmp79_ = _tmp77_[_tmp78_];
712                         _vala_assert ((_tmp76_) == (*_tmp79_), "element == double_array[index++]");
713                 }
714                 _g_object_unref0 (_element_list);
715         }
716         double_array = (_vala_array_free (double_array, double_array_length1, (GDestroyNotify) g_free), NULL);
717         _g_object_unref0 (double_list);
718         int_array = (g_free (int_array), NULL);
719         _g_object_unref0 (int_list);
720         bool_array = (g_free (bool_array), NULL);
721         _g_object_unref0 (bool_list);
722 }
723
724
725 static void array_list_tests_class_init (ArrayListTestsClass * klass) {
726         array_list_tests_parent_class = g_type_class_peek_parent (klass);
727         GEE_TEST_CASE_CLASS (klass)->set_up = array_list_tests_real_set_up;
728         GEE_TEST_CASE_CLASS (klass)->tear_down = array_list_tests_real_tear_down;
729 }
730
731
732 static void array_list_tests_instance_init (ArrayListTests * self) {
733 }
734
735
736 GType array_list_tests_get_type (void) {
737         static volatile gsize array_list_tests_type_id__volatile = 0;
738         if (g_once_init_enter (&array_list_tests_type_id__volatile)) {
739                 static const GTypeInfo g_define_type_info = { sizeof (ArrayListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) array_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ArrayListTests), 0, (GInstanceInitFunc) array_list_tests_instance_init, NULL };
740                 GType array_list_tests_type_id;
741                 array_list_tests_type_id = g_type_register_static (TYPE_LIST_TESTS, "ArrayListTests", &g_define_type_info, 0);
742                 g_once_init_leave (&array_list_tests_type_id__volatile, array_list_tests_type_id);
743         }
744         return array_list_tests_type_id__volatile;
745 }
746
747
748 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
749         if ((array != NULL) && (destroy_func != NULL)) {
750                 int i;
751                 for (i = 0; i < array_length; i = i + 1) {
752                         if (((gpointer*) array)[i] != NULL) {
753                                 destroy_func (((gpointer*) array)[i]);
754                         }
755                 }
756         }
757 }
758
759
760 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
761         _vala_array_destroy (array, array_length, destroy_func);
762         g_free (array);
763 }
764
765
766