1 /* testarraylist.c generated by valac 0.18.0, the Vala compiler
2 * generated from testarraylist.vala, do not modify */
6 * Copyright (C) 2008 Jürg Billeter
7 * Copyright (C) 2009 Didier Villevalois, Julien Peeters
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.
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.
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
24 * Jürg Billeter <j@bitron.ch>
25 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
26 * Julien Peeters <contact@julienpeeters.fr>
30 #include <glib-object.h>
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))
45 typedef struct _GeeTestCase GeeTestCase;
46 typedef struct _GeeTestCaseClass GeeTestCaseClass;
47 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
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))
56 typedef struct _CollectionTests CollectionTests;
57 typedef struct _CollectionTestsClass CollectionTestsClass;
58 typedef struct _CollectionTestsPrivate CollectionTestsPrivate;
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))
67 typedef struct _ListTests ListTests;
68 typedef struct _ListTestsClass ListTestsClass;
69 typedef struct _ListTestsPrivate ListTestsPrivate;
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))
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);
86 GObject parent_instance;
87 GeeTestCasePrivate * priv;
90 struct _GeeTestCaseClass {
91 GObjectClass parent_class;
92 void (*set_up) (GeeTestCase* self);
93 void (*tear_down) (GeeTestCase* self);
96 struct _CollectionTests {
97 GeeTestCase parent_instance;
98 CollectionTestsPrivate * priv;
99 GeeCollection* test_collection;
102 struct _CollectionTestsClass {
103 GeeTestCaseClass parent_class;
107 CollectionTests parent_instance;
108 ListTestsPrivate * priv;
111 struct _ListTestsClass {
112 CollectionTestsClass parent_class;
113 void (*test_duplicates_are_retained) (ListTests* self);
116 struct _ArrayListTests {
117 ListTests parent_instance;
118 ArrayListTestsPrivate * priv;
121 struct _ArrayListTestsClass {
122 ListTestsClass parent_class;
125 typedef void (*GeeTestCaseTestMethod) (void* user_data);
127 static gpointer array_list_tests_parent_class = NULL;
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;
134 ARRAY_LIST_TESTS_DUMMY_PROPERTY
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);
158 static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) {
159 array_list_tests_test_selected_functions (self);
163 static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) {
164 array_list_tests_test_gobject_properties (self);
168 static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self) {
169 array_list_tests_test_small_sort (self);
173 static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self) {
174 array_list_tests_test_big_sort (self);
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);
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);
195 ArrayListTests* array_list_tests_new (void) {
196 return array_list_tests_construct (TYPE_ARRAY_LIST_TESTS);
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_;
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;
218 static gpointer _g_object_ref0 (gpointer self) {
219 return self ? g_object_ref (self) : NULL;
223 void array_list_tests_test_selected_functions (ArrayListTests* self) {
224 GeeCollection* _tmp0_;
225 GeeArrayList* _tmp1_;
226 GeeArrayList* test_list;
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);
234 _vala_assert (test_list != NULL, "test_list != null");
235 _tmp2_ = gee_array_list_get_equal_func (test_list);
237 _tmp4_ = g_str_equal;
238 _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal");
239 _g_object_unref0 (test_list);
243 void array_list_tests_test_gobject_properties (ArrayListTests* self) {
244 GeeCollection* _tmp0_;
245 GeeArrayList* _tmp1_;
246 GeeArrayList* test_list;
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);
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;
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);
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);
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;
279 gpointer _tmp4_ = NULL;
281 gpointer _tmp6_ = NULL;
283 gpointer _tmp8_ = NULL;
285 gpointer _tmp10_ = NULL;
287 gpointer _tmp12_ = NULL;
289 gpointer _tmp14_ = NULL;
291 gpointer _tmp16_ = NULL;
293 gpointer _tmp18_ = NULL;
295 gpointer _tmp20_ = NULL;
297 gpointer _tmp22_ = NULL;
299 gpointer _tmp24_ = NULL;
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);
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
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\"");
367 _g_object_unref0 (test_list);
371 static void array_list_tests_test_big_sort (ArrayListTests* self) {
372 GeeArrayList* _tmp0_;
373 GeeList* big_test_list;
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_;
397 if (!(_tmp4_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
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_));
406 _tmp7_ = big_test_list;
407 gee_list_sort (_tmp7_, NULL);
419 gpointer _tmp14_ = NULL;
422 gpointer _tmp17_ = NULL;
431 if (!(_tmp11_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
434 _tmp12_ = big_test_list;
436 _tmp14_ = gee_list_get (_tmp12_, _tmp13_ - 1);
437 _tmp15_ = big_test_list;
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]");
444 _g_object_unref0 (big_test_list);
448 static gdouble* _double_dup (gdouble* self) {
450 dup = g_new0 (gdouble, 1);
451 memcpy (dup, self, sizeof (gdouble));
456 static void array_list_tests_test_typed_to_array (ArrayListTests* self) {
457 GeeArrayList* _tmp0_;
460 gboolean _tmp2_ = FALSE;
462 gboolean _tmp4_ = FALSE;
464 gboolean _tmp6_ = FALSE;
467 gpointer* _tmp9_ = NULL;
468 gboolean* bool_array;
469 gint bool_array_length1;
470 gint _bool_array_size_;
472 GeeArrayList* _tmp25_;
475 gboolean _tmp27_ = FALSE;
477 gboolean _tmp29_ = FALSE;
479 gboolean _tmp31_ = FALSE;
482 gpointer* _tmp34_ = NULL;
484 gint int_array_length1;
485 gint _int_array_size_;
486 GeeArrayList* _tmp50_;
487 GeeList* double_list;
490 gboolean _tmp53_ = FALSE;
493 gboolean _tmp56_ = FALSE;
496 gboolean _tmp59_ = FALSE;
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_;
507 _tmp2_ = gee_collection_add ((GeeCollection*) _tmp1_, (gpointer) ((gintptr) TRUE));
508 _vala_assert (_tmp2_, "bool_list.add (true)");
510 _tmp4_ = gee_collection_add ((GeeCollection*) _tmp3_, (gpointer) ((gintptr) TRUE));
511 _vala_assert (_tmp4_, "bool_list.add (true)");
513 _tmp6_ = gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) FALSE));
514 _vala_assert (_tmp6_, "bool_list.add (false)");
516 _tmp9_ = gee_collection_to_array ((GeeCollection*) _tmp7_, &_tmp8_);
518 bool_array_length1 = _tmp8_;
519 _bool_array_size_ = bool_array_length1;
524 GeeList* _element_list;
531 _tmp11_ = _g_object_ref0 (_tmp10_);
532 _element_list = _tmp11_;
533 _tmp12_ = _element_list;
534 _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_);
536 _element_size = _tmp14_;
544 gpointer _tmp20_ = NULL;
548 gint _tmp22__length1;
551 _tmp15_ = _element_index;
552 _element_index = _tmp15_ + 1;
553 _tmp16_ = _element_index;
554 _tmp17_ = _element_size;
555 if (!(_tmp16_ < _tmp17_)) {
558 _tmp18_ = _element_list;
559 _tmp19_ = _element_index;
560 _tmp20_ = gee_list_get (_tmp18_, _tmp19_);
561 element = (gboolean) ((gintptr) _tmp20_);
563 _tmp22_ = bool_array;
564 _tmp22__length1 = bool_array_length1;
567 _tmp24_ = _tmp22_[_tmp23_];
568 _vala_assert (_tmp21_ == _tmp24_, "element == bool_array[index++]");
570 _g_object_unref0 (_element_list);
572 _tmp25_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL);
573 int_list = (GeeList*) _tmp25_;
575 _tmp27_ = gee_collection_add ((GeeCollection*) _tmp26_, (gpointer) ((gintptr) 1));
576 _vala_assert (_tmp27_, "int_list.add (1)");
578 _tmp29_ = gee_collection_add ((GeeCollection*) _tmp28_, (gpointer) ((gintptr) 2));
579 _vala_assert (_tmp29_, "int_list.add (2)");
581 _tmp31_ = gee_collection_add ((GeeCollection*) _tmp30_, (gpointer) ((gintptr) 3));
582 _vala_assert (_tmp31_, "int_list.add (3)");
584 _tmp34_ = gee_collection_to_array ((GeeCollection*) _tmp32_, &_tmp33_);
586 int_array_length1 = _tmp33_;
587 _int_array_size_ = int_array_length1;
592 GeeList* _element_list;
599 _tmp36_ = _g_object_ref0 (_tmp35_);
600 _element_list = _tmp36_;
601 _tmp37_ = _element_list;
602 _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_);
604 _element_size = _tmp39_;
612 gpointer _tmp45_ = NULL;
616 gint _tmp47__length1;
619 _tmp40_ = _element_index;
620 _element_index = _tmp40_ + 1;
621 _tmp41_ = _element_index;
622 _tmp42_ = _element_size;
623 if (!(_tmp41_ < _tmp42_)) {
626 _tmp43_ = _element_list;
627 _tmp44_ = _element_index;
628 _tmp45_ = gee_list_get (_tmp43_, _tmp44_);
629 element = (gint) ((gintptr) _tmp45_);
632 _tmp47__length1 = int_array_length1;
635 _tmp49_ = _tmp47_[_tmp48_];
636 _vala_assert (_tmp46_ == _tmp49_, "element == int_array[index++]");
638 _g_object_unref0 (_element_list);
640 _tmp50_ = gee_array_list_new (G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, g_free, NULL);
641 double_list = (GeeList*) _tmp50_;
642 _tmp51_ = double_list;
644 _tmp53_ = gee_collection_add ((GeeCollection*) _tmp51_, &_tmp52_);
645 _vala_assert (_tmp53_, "double_list.add (1.0d)");
646 _tmp54_ = double_list;
648 _tmp56_ = gee_collection_add ((GeeCollection*) _tmp54_, &_tmp55_);
649 _vala_assert (_tmp56_, "double_list.add (1.5d)");
650 _tmp57_ = double_list;
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;
663 GeeList* _element_list;
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_);
675 _element_size = _tmp67_;
683 gpointer _tmp73_ = NULL;
689 gint _tmp77__length1;
692 _tmp68_ = _element_index;
693 _element_index = _tmp68_ + 1;
694 _tmp69_ = _element_index;
695 _tmp70_ = _element_size;
696 if (!(_tmp69_ < _tmp70_)) {
699 _tmp71_ = _element_list;
700 _tmp72_ = _element_index;
701 _tmp73_ = gee_list_get (_tmp71_, _tmp72_);
702 _tmp74_ = (gdouble*) _tmp73_;
707 _tmp77_ = double_array;
708 _tmp77__length1 = double_array_length1;
711 _tmp79_ = _tmp77_[_tmp78_];
712 _vala_assert ((_tmp76_) == (*_tmp79_), "element == double_array[index++]");
714 _g_object_unref0 (_element_list);
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);
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;
732 static void array_list_tests_instance_init (ArrayListTests * self) {
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);
744 return array_list_tests_type_id__volatile;
748 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
749 if ((array != NULL) && (destroy_func != NULL)) {
751 for (i = 0; i < array_length; i = i + 1) {
752 if (((gpointer*) array)[i] != NULL) {
753 destroy_func (((gpointer*) array)[i]);
760 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
761 _vala_array_destroy (array, array_length, destroy_func);