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_BIDIR_LIST_TESTS (bidir_list_tests_get_type ())
72 #define BIDIR_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BIDIR_LIST_TESTS, BidirListTests))
73 #define BIDIR_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BIDIR_LIST_TESTS, BidirListTestsClass))
74 #define IS_BIDIR_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BIDIR_LIST_TESTS))
75 #define IS_BIDIR_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BIDIR_LIST_TESTS))
76 #define BIDIR_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BIDIR_LIST_TESTS, BidirListTestsClass))
78 typedef struct _BidirListTests BidirListTests;
79 typedef struct _BidirListTestsClass BidirListTestsClass;
80 typedef struct _BidirListTestsPrivate BidirListTestsPrivate;
82 #define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ())
83 #define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests))
84 #define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass))
85 #define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS))
86 #define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS))
87 #define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass))
89 typedef struct _ArrayListTests ArrayListTests;
90 typedef struct _ArrayListTestsClass ArrayListTestsClass;
91 typedef struct _ArrayListTestsPrivate ArrayListTestsPrivate;
92 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
93 #define _g_free0(var) (var = (g_free (var), NULL))
94 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
97 GObject parent_instance;
98 GeeTestCasePrivate * priv;
101 struct _GeeTestCaseClass {
102 GObjectClass parent_class;
103 void (*set_up) (GeeTestCase* self);
104 void (*tear_down) (GeeTestCase* self);
107 struct _CollectionTests {
108 GeeTestCase parent_instance;
109 CollectionTestsPrivate * priv;
110 GeeCollection* test_collection;
113 struct _CollectionTestsClass {
114 GeeTestCaseClass parent_class;
118 CollectionTests parent_instance;
119 ListTestsPrivate * priv;
122 struct _ListTestsClass {
123 CollectionTestsClass parent_class;
124 void (*test_duplicates_are_retained) (ListTests* self);
127 struct _BidirListTests {
128 ListTests parent_instance;
129 BidirListTestsPrivate * priv;
132 struct _BidirListTestsClass {
133 ListTestsClass parent_class;
136 struct _ArrayListTests {
137 BidirListTests parent_instance;
138 ArrayListTestsPrivate * priv;
141 struct _ArrayListTestsClass {
142 BidirListTestsClass parent_class;
145 typedef void (*GeeTestCaseTestMethod) (void* user_data);
147 static gpointer array_list_tests_parent_class = NULL;
149 GType gee_test_case_get_type (void) G_GNUC_CONST;
150 GType collection_tests_get_type (void) G_GNUC_CONST;
151 GType list_tests_get_type (void) G_GNUC_CONST;
152 GType bidir_list_tests_get_type (void) G_GNUC_CONST;
153 GType array_list_tests_get_type (void) G_GNUC_CONST;
155 ARRAY_LIST_TESTS_DUMMY_PROPERTY
157 #define ARRAY_LIST_TESTS_BIG_SORT_SIZE 1000000
158 ArrayListTests* array_list_tests_new (void);
159 ArrayListTests* array_list_tests_construct (GType object_type);
160 BidirListTests* bidir_list_tests_construct (GType object_type, const gchar* name);
161 void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GDestroyNotify test_target_destroy_notify);
162 void array_list_tests_test_selected_functions (ArrayListTests* self);
163 static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self);
164 static void array_list_tests_test_small_sort (ArrayListTests* self);
165 static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self);
166 static void array_list_tests_test_big_sort (ArrayListTests* self);
167 static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self);
168 static void array_list_tests_test_typed_to_array (ArrayListTests* self);
169 static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self);
170 static void array_list_tests_real_set_up (GeeTestCase* base);
171 static void array_list_tests_real_tear_down (GeeTestCase* base);
172 static gdouble* _double_dup (gdouble* self);
173 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
174 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
177 static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) {
178 array_list_tests_test_selected_functions (self);
182 static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self) {
183 array_list_tests_test_small_sort (self);
187 static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self) {
188 array_list_tests_test_big_sort (self);
192 static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self) {
193 array_list_tests_test_typed_to_array (self);
197 ArrayListTests* array_list_tests_construct (GType object_type) {
198 ArrayListTests * self = NULL;
199 self = (ArrayListTests*) bidir_list_tests_construct (object_type, "ArrayList");
200 gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] selected functions", _array_list_tests_test_selected_functions_gee_test_case_test_method, g_object_ref (self), g_object_unref);
201 gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] small sort (insertion)", _array_list_tests_test_small_sort_gee_test_case_test_method, g_object_ref (self), g_object_unref);
202 gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] big sort (timsort)", _array_list_tests_test_big_sort_gee_test_case_test_method, g_object_ref (self), g_object_unref);
203 gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] typed to_array calls", _array_list_tests_test_typed_to_array_gee_test_case_test_method, g_object_ref (self), g_object_unref);
208 ArrayListTests* array_list_tests_new (void) {
209 return array_list_tests_construct (TYPE_ARRAY_LIST_TESTS);
213 static void array_list_tests_real_set_up (GeeTestCase* base) {
214 ArrayListTests * self;
215 GeeArrayList* _tmp0_;
216 self = (ArrayListTests*) base;
217 _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
218 _g_object_unref0 (((CollectionTests*) self)->test_collection);
219 ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_;
223 static void array_list_tests_real_tear_down (GeeTestCase* base) {
224 ArrayListTests * self;
225 self = (ArrayListTests*) base;
226 _g_object_unref0 (((CollectionTests*) self)->test_collection);
227 ((CollectionTests*) self)->test_collection = NULL;
231 static gpointer _g_object_ref0 (gpointer self) {
232 return self ? g_object_ref (self) : NULL;
236 void array_list_tests_test_selected_functions (ArrayListTests* self) {
237 GeeCollection* _tmp0_;
238 GeeArrayList* _tmp1_;
239 GeeArrayList* test_list;
240 g_return_if_fail (self != NULL);
241 _tmp0_ = ((CollectionTests*) self)->test_collection;
242 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL);
244 _vala_assert (test_list != NULL, "test_list != null");
245 _g_object_unref0 (test_list);
249 static void array_list_tests_test_small_sort (ArrayListTests* self) {
250 GeeCollection* _tmp0_;
251 GeeArrayList* _tmp1_;
252 GeeArrayList* test_list;
253 gpointer _tmp2_ = NULL;
255 gpointer _tmp4_ = NULL;
257 gpointer _tmp6_ = NULL;
259 gpointer _tmp8_ = NULL;
261 gpointer _tmp10_ = NULL;
263 gpointer _tmp12_ = NULL;
265 gpointer _tmp14_ = NULL;
267 gpointer _tmp16_ = NULL;
269 gpointer _tmp18_ = NULL;
271 gpointer _tmp20_ = NULL;
273 gpointer _tmp22_ = NULL;
275 gpointer _tmp24_ = NULL;
277 g_return_if_fail (self != NULL);
278 _tmp0_ = ((CollectionTests*) self)->test_collection;
279 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL);
281 _vala_assert (test_list != NULL, "test_list != null");
282 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one");
283 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two");
284 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three");
285 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four");
286 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five");
287 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six");
288 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven");
289 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight");
290 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine");
291 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten");
292 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven");
293 gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve");
294 gee_list_sort ((GeeList*) test_list, NULL, NULL, NULL);
295 _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0);
296 _tmp3_ = (gchar*) _tmp2_;
297 _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\"");
299 _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1);
300 _tmp5_ = (gchar*) _tmp4_;
301 _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\"");
303 _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2);
304 _tmp7_ = (gchar*) _tmp6_;
305 _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\"");
307 _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3);
308 _tmp9_ = (gchar*) _tmp8_;
309 _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\"");
311 _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4);
312 _tmp11_ = (gchar*) _tmp10_;
313 _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\"");
315 _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5);
316 _tmp13_ = (gchar*) _tmp12_;
317 _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\"");
319 _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6);
320 _tmp15_ = (gchar*) _tmp14_;
321 _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\"");
323 _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7);
324 _tmp17_ = (gchar*) _tmp16_;
325 _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\"");
327 _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8);
328 _tmp19_ = (gchar*) _tmp18_;
329 _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\"");
331 _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9);
332 _tmp21_ = (gchar*) _tmp20_;
333 _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\"");
335 _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10);
336 _tmp23_ = (gchar*) _tmp22_;
337 _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\"");
339 _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11);
340 _tmp25_ = (gchar*) _tmp24_;
341 _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\"");
343 _g_object_unref0 (test_list);
347 static void array_list_tests_test_big_sort (ArrayListTests* self) {
348 GeeArrayList* _tmp0_;
349 GeeList* big_test_list;
351 g_return_if_fail (self != NULL);
352 _tmp0_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL);
353 big_test_list = (GeeList*) _tmp0_;
373 if (!(_tmp4_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
376 _tmp5_ = big_test_list;
377 _tmp6_ = g_random_int_range ((gint32) 1, (gint32) (ARRAY_LIST_TESTS_BIG_SORT_SIZE - 1));
378 gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) _tmp6_));
382 _tmp7_ = big_test_list;
383 gee_list_sort (_tmp7_, NULL, NULL, NULL);
395 gpointer _tmp14_ = NULL;
398 gpointer _tmp17_ = NULL;
407 if (!(_tmp11_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) {
410 _tmp12_ = big_test_list;
412 _tmp14_ = gee_list_get (_tmp12_, _tmp13_ - 1);
413 _tmp15_ = big_test_list;
415 _tmp17_ = gee_list_get (_tmp15_, _tmp16_);
416 _vala_assert (((gint32) ((gintptr) _tmp14_)) <= ((gint32) ((gintptr) _tmp17_)), "big_test_list[i - 1] <= big_test_list[i]");
420 _g_object_unref0 (big_test_list);
424 static gdouble* _double_dup (gdouble* self) {
426 dup = g_new0 (gdouble, 1);
427 memcpy (dup, self, sizeof (gdouble));
432 static void array_list_tests_test_typed_to_array (ArrayListTests* self) {
433 GeeArrayList* _tmp0_;
436 gboolean _tmp2_ = FALSE;
438 gboolean _tmp4_ = FALSE;
440 gboolean _tmp6_ = FALSE;
443 gpointer* _tmp9_ = NULL;
444 gboolean* bool_array;
445 gint bool_array_length1;
446 gint _bool_array_size_;
448 GeeArrayList* _tmp25_;
451 gboolean _tmp27_ = FALSE;
453 gboolean _tmp29_ = FALSE;
455 gboolean _tmp31_ = FALSE;
458 gpointer* _tmp34_ = NULL;
460 gint int_array_length1;
461 gint _int_array_size_;
462 GeeArrayList* _tmp50_;
463 GeeList* double_list;
466 gboolean _tmp53_ = FALSE;
469 gboolean _tmp56_ = FALSE;
472 gboolean _tmp59_ = FALSE;
475 gpointer* _tmp62_ = NULL;
476 gdouble** double_array;
477 gint double_array_length1;
478 gint _double_array_size_;
479 g_return_if_fail (self != NULL);
480 _tmp0_ = gee_array_list_new (G_TYPE_BOOLEAN, NULL, NULL, NULL, NULL, NULL);
481 bool_list = (GeeList*) _tmp0_;
483 _tmp2_ = gee_collection_add ((GeeCollection*) _tmp1_, (gpointer) ((gintptr) TRUE));
484 _vala_assert (_tmp2_, "bool_list.add (true)");
486 _tmp4_ = gee_collection_add ((GeeCollection*) _tmp3_, (gpointer) ((gintptr) TRUE));
487 _vala_assert (_tmp4_, "bool_list.add (true)");
489 _tmp6_ = gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) FALSE));
490 _vala_assert (_tmp6_, "bool_list.add (false)");
492 _tmp9_ = gee_collection_to_array ((GeeCollection*) _tmp7_, &_tmp8_);
494 bool_array_length1 = _tmp8_;
495 _bool_array_size_ = bool_array_length1;
500 GeeList* _element_list;
507 _tmp11_ = _g_object_ref0 (_tmp10_);
508 _element_list = _tmp11_;
509 _tmp12_ = _element_list;
510 _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_);
512 _element_size = _tmp14_;
520 gpointer _tmp20_ = NULL;
524 gint _tmp22__length1;
527 _tmp15_ = _element_index;
528 _element_index = _tmp15_ + 1;
529 _tmp16_ = _element_index;
530 _tmp17_ = _element_size;
531 if (!(_tmp16_ < _tmp17_)) {
534 _tmp18_ = _element_list;
535 _tmp19_ = _element_index;
536 _tmp20_ = gee_list_get (_tmp18_, _tmp19_);
537 element = (gboolean) ((gintptr) _tmp20_);
539 _tmp22_ = bool_array;
540 _tmp22__length1 = bool_array_length1;
543 _tmp24_ = _tmp22_[_tmp23_];
544 _vala_assert (_tmp21_ == _tmp24_, "element == bool_array[index++]");
546 _g_object_unref0 (_element_list);
548 _tmp25_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL);
549 int_list = (GeeList*) _tmp25_;
551 _tmp27_ = gee_collection_add ((GeeCollection*) _tmp26_, (gpointer) ((gintptr) 1));
552 _vala_assert (_tmp27_, "int_list.add (1)");
554 _tmp29_ = gee_collection_add ((GeeCollection*) _tmp28_, (gpointer) ((gintptr) 2));
555 _vala_assert (_tmp29_, "int_list.add (2)");
557 _tmp31_ = gee_collection_add ((GeeCollection*) _tmp30_, (gpointer) ((gintptr) 3));
558 _vala_assert (_tmp31_, "int_list.add (3)");
560 _tmp34_ = gee_collection_to_array ((GeeCollection*) _tmp32_, &_tmp33_);
562 int_array_length1 = _tmp33_;
563 _int_array_size_ = int_array_length1;
568 GeeList* _element_list;
575 _tmp36_ = _g_object_ref0 (_tmp35_);
576 _element_list = _tmp36_;
577 _tmp37_ = _element_list;
578 _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_);
580 _element_size = _tmp39_;
588 gpointer _tmp45_ = NULL;
592 gint _tmp47__length1;
595 _tmp40_ = _element_index;
596 _element_index = _tmp40_ + 1;
597 _tmp41_ = _element_index;
598 _tmp42_ = _element_size;
599 if (!(_tmp41_ < _tmp42_)) {
602 _tmp43_ = _element_list;
603 _tmp44_ = _element_index;
604 _tmp45_ = gee_list_get (_tmp43_, _tmp44_);
605 element = (gint) ((gintptr) _tmp45_);
608 _tmp47__length1 = int_array_length1;
611 _tmp49_ = _tmp47_[_tmp48_];
612 _vala_assert (_tmp46_ == _tmp49_, "element == int_array[index++]");
614 _g_object_unref0 (_element_list);
616 _tmp50_ = gee_array_list_new (G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, g_free, NULL, NULL, NULL);
617 double_list = (GeeList*) _tmp50_;
618 _tmp51_ = double_list;
620 _tmp53_ = gee_collection_add ((GeeCollection*) _tmp51_, &_tmp52_);
621 _vala_assert (_tmp53_, "double_list.add (1.0d)");
622 _tmp54_ = double_list;
624 _tmp56_ = gee_collection_add ((GeeCollection*) _tmp54_, &_tmp55_);
625 _vala_assert (_tmp56_, "double_list.add (1.5d)");
626 _tmp57_ = double_list;
628 _tmp59_ = gee_collection_add ((GeeCollection*) _tmp57_, &_tmp58_);
629 _vala_assert (_tmp59_, "double_list.add (2.0d)");
630 _tmp60_ = double_list;
631 _tmp62_ = gee_collection_to_array ((GeeCollection*) _tmp60_, &_tmp61_);
632 double_array = _tmp62_;
633 double_array_length1 = _tmp61_;
634 _double_array_size_ = double_array_length1;
639 GeeList* _element_list;
645 _tmp63_ = double_list;
646 _tmp64_ = _g_object_ref0 (_tmp63_);
647 _element_list = _tmp64_;
648 _tmp65_ = _element_list;
649 _tmp66_ = gee_collection_get_size ((GeeCollection*) _tmp65_);
651 _element_size = _tmp67_;
659 gpointer _tmp73_ = NULL;
665 gint _tmp77__length1;
668 _tmp68_ = _element_index;
669 _element_index = _tmp68_ + 1;
670 _tmp69_ = _element_index;
671 _tmp70_ = _element_size;
672 if (!(_tmp69_ < _tmp70_)) {
675 _tmp71_ = _element_list;
676 _tmp72_ = _element_index;
677 _tmp73_ = gee_list_get (_tmp71_, _tmp72_);
678 _tmp74_ = (gdouble*) _tmp73_;
683 _tmp77_ = double_array;
684 _tmp77__length1 = double_array_length1;
687 _tmp79_ = _tmp77_[_tmp78_];
688 _vala_assert ((_tmp76_) == (*_tmp79_), "element == double_array[index++]");
690 _g_object_unref0 (_element_list);
692 double_array = (_vala_array_free (double_array, double_array_length1, (GDestroyNotify) g_free), NULL);
693 _g_object_unref0 (double_list);
694 int_array = (g_free (int_array), NULL);
695 _g_object_unref0 (int_list);
696 bool_array = (g_free (bool_array), NULL);
697 _g_object_unref0 (bool_list);
701 static void array_list_tests_class_init (ArrayListTestsClass * klass) {
702 array_list_tests_parent_class = g_type_class_peek_parent (klass);
703 GEE_TEST_CASE_CLASS (klass)->set_up = array_list_tests_real_set_up;
704 GEE_TEST_CASE_CLASS (klass)->tear_down = array_list_tests_real_tear_down;
708 static void array_list_tests_instance_init (ArrayListTests * self) {
712 GType array_list_tests_get_type (void) {
713 static volatile gsize array_list_tests_type_id__volatile = 0;
714 if (g_once_init_enter (&array_list_tests_type_id__volatile)) {
715 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 };
716 GType array_list_tests_type_id;
717 array_list_tests_type_id = g_type_register_static (TYPE_BIDIR_LIST_TESTS, "ArrayListTests", &g_define_type_info, 0);
718 g_once_init_leave (&array_list_tests_type_id__volatile, array_list_tests_type_id);
720 return array_list_tests_type_id__volatile;
724 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
725 if ((array != NULL) && (destroy_func != NULL)) {
727 for (i = 0; i < array_length; i = i + 1) {
728 if (((gpointer*) array)[i] != NULL) {
729 destroy_func (((gpointer*) array)[i]);
736 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
737 _vala_array_destroy (array, array_length, destroy_func);