1 /* testreadonlylist.c generated by valac 0.18.0, the Vala compiler
2 * generated from testreadonlylist.vala, do not modify */
4 /* testreadonlylist.vala
6 * Copyright (C) 2008 Jürg Billeter
7 * Copyright (C) 2009 Didier Villevalois
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 * Tomaž Vajngerl <quikee@gmail.com>
25 * Julien Peeters <contact@julienpeeters.fr>
26 * Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
30 #include <glib-object.h>
36 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
37 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
38 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
39 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
40 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
41 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
43 typedef struct _GeeTestCase GeeTestCase;
44 typedef struct _GeeTestCaseClass GeeTestCaseClass;
45 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
47 #define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ())
48 #define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests))
49 #define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass))
50 #define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS))
51 #define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS))
52 #define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass))
54 typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests;
55 typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass;
56 typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate;
58 #define TYPE_READ_ONLY_LIST_TESTS (read_only_list_tests_get_type ())
59 #define READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTests))
60 #define READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass))
61 #define IS_READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_LIST_TESTS))
62 #define IS_READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_LIST_TESTS))
63 #define READ_ONLY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass))
65 typedef struct _ReadOnlyListTests ReadOnlyListTests;
66 typedef struct _ReadOnlyListTestsClass ReadOnlyListTestsClass;
67 typedef struct _ReadOnlyListTestsPrivate ReadOnlyListTestsPrivate;
68 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
69 #define _g_free0(var) (var = (g_free (var), NULL))
70 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
73 GObject parent_instance;
74 GeeTestCasePrivate * priv;
77 struct _GeeTestCaseClass {
78 GObjectClass parent_class;
79 void (*set_up) (GeeTestCase* self);
80 void (*tear_down) (GeeTestCase* self);
83 struct _ReadOnlyCollectionTests {
84 GeeTestCase parent_instance;
85 ReadOnlyCollectionTestsPrivate * priv;
86 GeeCollection* test_collection;
87 GeeCollection* ro_collection;
90 struct _ReadOnlyCollectionTestsClass {
91 GeeTestCaseClass parent_class;
92 GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection);
95 struct _ReadOnlyListTests {
96 ReadOnlyCollectionTests parent_instance;
97 ReadOnlyListTestsPrivate * priv;
100 struct _ReadOnlyListTestsClass {
101 ReadOnlyCollectionTestsClass parent_class;
104 typedef void (*GeeTestCaseTestMethod) (void* user_data);
106 static gpointer read_only_list_tests_parent_class = NULL;
108 GType gee_test_case_get_type (void) G_GNUC_CONST;
109 GType read_only_collection_tests_get_type (void) G_GNUC_CONST;
110 GType read_only_list_tests_get_type (void) G_GNUC_CONST;
112 READ_ONLY_LIST_TESTS_DUMMY_PROPERTY
114 ReadOnlyListTests* read_only_list_tests_new (void);
115 ReadOnlyListTests* read_only_list_tests_construct (GType object_type);
116 ReadOnlyListTests* read_only_list_tests_new_with_name (const gchar* name);
117 ReadOnlyListTests* read_only_list_tests_construct_with_name (GType object_type, const gchar* name);
118 ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name);
119 ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name);
120 void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GDestroyNotify test_target_destroy_notify);
121 void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self);
122 static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self);
123 void read_only_list_tests_test_immutable (ReadOnlyListTests* self);
124 static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self);
125 void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self);
126 static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self);
127 static void read_only_list_tests_real_set_up (GeeTestCase* base);
128 GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection);
129 static void read_only_list_tests_real_tear_down (GeeTestCase* base);
130 static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection);
133 ReadOnlyListTests* read_only_list_tests_construct (GType object_type) {
134 ReadOnlyListTests * self = NULL;
135 self = (ReadOnlyListTests*) read_only_list_tests_construct_with_name (object_type, "ReadOnlyList");
140 ReadOnlyListTests* read_only_list_tests_new (void) {
141 return read_only_list_tests_construct (TYPE_READ_ONLY_LIST_TESTS);
145 static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) {
146 read_only_list_tests_test_immutable_iterator (self);
150 static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self) {
151 read_only_list_tests_test_immutable (self);
155 static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self) {
156 read_only_list_tests_test_accurate_view (self);
160 ReadOnlyListTests* read_only_list_tests_construct_with_name (GType object_type, const gchar* name) {
161 ReadOnlyListTests * self = NULL;
163 g_return_val_if_fail (name != NULL, NULL);
165 self = (ReadOnlyListTests*) read_only_collection_tests_construct_with_name (object_type, _tmp0_);
166 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable iterator", _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method, g_object_ref (self), g_object_unref);
167 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable", _read_only_list_tests_test_immutable_gee_test_case_test_method, g_object_ref (self), g_object_unref);
168 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] accurate view", _read_only_list_tests_test_accurate_view_gee_test_case_test_method, g_object_ref (self), g_object_unref);
173 ReadOnlyListTests* read_only_list_tests_new_with_name (const gchar* name) {
174 return read_only_list_tests_construct_with_name (TYPE_READ_ONLY_LIST_TESTS, name);
178 static void read_only_list_tests_real_set_up (GeeTestCase* base) {
179 ReadOnlyListTests * self;
180 GeeArrayList* _tmp0_;
181 GeeCollection* _tmp1_;
182 GeeCollection* _tmp2_ = NULL;
183 self = (ReadOnlyListTests*) base;
184 _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
185 _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection);
186 ((ReadOnlyCollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_;
187 _tmp1_ = ((ReadOnlyCollectionTests*) self)->test_collection;
188 _tmp2_ = read_only_collection_tests_get_ro_view ((ReadOnlyCollectionTests*) self, _tmp1_);
189 _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection);
190 ((ReadOnlyCollectionTests*) self)->ro_collection = _tmp2_;
194 static void read_only_list_tests_real_tear_down (GeeTestCase* base) {
195 ReadOnlyListTests * self;
196 self = (ReadOnlyListTests*) base;
197 _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection);
198 ((ReadOnlyCollectionTests*) self)->test_collection = NULL;
199 _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection);
200 ((ReadOnlyCollectionTests*) self)->ro_collection = NULL;
204 static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection) {
205 ReadOnlyListTests * self;
206 GeeCollection* result = NULL;
207 GeeCollection* _tmp0_;
210 self = (ReadOnlyListTests*) base;
211 g_return_val_if_fail (collection != NULL, NULL);
213 _tmp1_ = gee_list_get_read_only_view (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList));
215 result = (GeeCollection*) _tmp2_;
220 static gpointer _g_object_ref0 (gpointer self) {
221 return self ? g_object_ref (self) : NULL;
225 void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self) {
226 GeeCollection* _tmp0_;
229 GeeCollection* _tmp2_;
233 gboolean _tmp5_ = FALSE;
235 gboolean _tmp7_ = FALSE;
240 gpointer _tmp12_ = NULL;
243 gpointer _tmp15_ = NULL;
246 GeeListIterator* _tmp18_ = NULL;
247 GeeListIterator* iterator;
248 GeeListIterator* _tmp19_;
249 gboolean _tmp20_ = FALSE;
250 GeeListIterator* _tmp21_;
251 gboolean _tmp22_ = FALSE;
252 GeeListIterator* _tmp23_;
253 gpointer _tmp24_ = NULL;
255 GeeListIterator* _tmp26_;
257 GeeListIterator* _tmp28_;
258 gboolean _tmp29_ = FALSE;
259 GeeListIterator* _tmp30_;
260 gboolean _tmp31_ = FALSE;
261 GeeListIterator* _tmp32_;
262 gpointer _tmp33_ = NULL;
264 GeeListIterator* _tmp35_;
266 GeeListIterator* _tmp37_;
267 gboolean _tmp38_ = FALSE;
268 GeeListIterator* _tmp39_;
269 gboolean _tmp40_ = FALSE;
271 GeeListIterator* _tmp42_ = NULL;
272 GeeListIterator* _tmp43_;
273 gboolean _tmp44_ = FALSE;
274 gboolean _tmp45_ = FALSE;
279 gpointer _tmp51_ = NULL;
282 gpointer _tmp54_ = NULL;
284 GeeListIterator* _tmp56_;
286 gboolean _tmp58_ = FALSE;
291 gpointer _tmp64_ = NULL;
294 gpointer _tmp67_ = NULL;
296 GeeListIterator* _tmp69_;
302 gpointer _tmp75_ = NULL;
305 gpointer _tmp78_ = NULL;
307 GeeListIterator* _tmp80_;
309 gboolean _tmp82_ = FALSE;
314 gpointer _tmp88_ = NULL;
317 gpointer _tmp91_ = NULL;
319 GeeListIterator* _tmp93_;
321 g_return_if_fail (self != NULL);
322 _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection;
323 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL);
325 _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection;
326 _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL);
329 _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one");
330 _vala_assert (_tmp5_, "test_list.add (\"one\")");
332 _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "two");
333 _vala_assert (_tmp7_, "test_list.add (\"two\")");
335 _tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_);
337 _vala_assert (_tmp10_ == 2, "ro_list.size == 2");
339 _tmp12_ = gee_list_get (_tmp11_, 0);
340 _tmp13_ = (gchar*) _tmp12_;
341 _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "ro_list.get (0) == \"one\"");
344 _tmp15_ = gee_list_get (_tmp14_, 1);
345 _tmp16_ = (gchar*) _tmp15_;
346 _vala_assert (g_strcmp0 (_tmp16_, "two") == 0, "ro_list.get (1) == \"two\"");
349 _tmp18_ = gee_list_list_iterator (_tmp17_);
352 _tmp20_ = gee_iterator_has_next ((GeeIterator*) _tmp19_);
353 _vala_assert (_tmp20_, "iterator.has_next ()");
355 _tmp22_ = gee_iterator_next ((GeeIterator*) _tmp21_);
356 _vala_assert (_tmp22_, "iterator.next ()");
358 _tmp24_ = gee_iterator_get ((GeeIterator*) _tmp23_);
359 _tmp25_ = (gchar*) _tmp24_;
360 _vala_assert (g_strcmp0 (_tmp25_, "one") == 0, "iterator.get () == \"one\"");
363 _tmp27_ = gee_list_iterator_index (_tmp26_);
364 _vala_assert (_tmp27_ == 0, "iterator.index () == 0");
366 _tmp29_ = gee_iterator_has_next ((GeeIterator*) _tmp28_);
367 _vala_assert (_tmp29_, "iterator.has_next ()");
369 _tmp31_ = gee_iterator_next ((GeeIterator*) _tmp30_);
370 _vala_assert (_tmp31_, "iterator.next ()");
372 _tmp33_ = gee_iterator_get ((GeeIterator*) _tmp32_);
373 _tmp34_ = (gchar*) _tmp33_;
374 _vala_assert (g_strcmp0 (_tmp34_, "two") == 0, "iterator.get () == \"two\"");
377 _tmp36_ = gee_list_iterator_index (_tmp35_);
378 _vala_assert (_tmp36_ == 1, "iterator.index () == 1");
380 _tmp38_ = gee_iterator_has_next ((GeeIterator*) _tmp37_);
381 _vala_assert (!_tmp38_, "! iterator.has_next ()");
383 _tmp40_ = gee_iterator_next ((GeeIterator*) _tmp39_);
384 _vala_assert (!_tmp40_, "! iterator.next ()");
386 _tmp42_ = gee_list_list_iterator (_tmp41_);
387 _g_object_unref0 (iterator);
390 _tmp44_ = gee_iterator_next ((GeeIterator*) _tmp43_);
391 _vala_assert (_tmp44_, "iterator.next ()");
392 _tmp45_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
394 GeeListIterator* _tmp46_;
396 gee_iterator_remove ((GeeIterator*) _tmp46_);
399 g_test_trap_assert_failed ();
401 _tmp48_ = gee_collection_get_size ((GeeCollection*) _tmp47_);
403 _vala_assert (_tmp49_ == 2, "ro_list.size == 2");
405 _tmp51_ = gee_list_get (_tmp50_, 0);
406 _tmp52_ = (gchar*) _tmp51_;
407 _vala_assert (g_strcmp0 (_tmp52_, "one") == 0, "ro_list.get (0) == \"one\"");
410 _tmp54_ = gee_list_get (_tmp53_, 1);
411 _tmp55_ = (gchar*) _tmp54_;
412 _vala_assert (g_strcmp0 (_tmp55_, "two") == 0, "ro_list.get (1) == \"two\"");
415 _tmp57_ = gee_list_iterator_index (_tmp56_);
416 _vala_assert (_tmp57_ == 0, "iterator.index () == 0");
417 _tmp58_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
419 GeeListIterator* _tmp59_;
421 gee_list_iterator_set (_tmp59_, "three");
424 g_test_trap_assert_failed ();
426 _tmp61_ = gee_collection_get_size ((GeeCollection*) _tmp60_);
428 _vala_assert (_tmp62_ == 2, "ro_list.size == 2");
430 _tmp64_ = gee_list_get (_tmp63_, 0);
431 _tmp65_ = (gchar*) _tmp64_;
432 _vala_assert (g_strcmp0 (_tmp65_, "one") == 0, "ro_list.get (0) == \"one\"");
435 _tmp67_ = gee_list_get (_tmp66_, 1);
436 _tmp68_ = (gchar*) _tmp67_;
437 _vala_assert (g_strcmp0 (_tmp68_, "two") == 0, "ro_list.get (1) == \"two\"");
440 _tmp70_ = gee_list_iterator_index (_tmp69_);
441 _vala_assert (_tmp70_ == 0, "iterator.index () == 0");
443 _tmp72_ = gee_collection_get_size ((GeeCollection*) _tmp71_);
445 _vala_assert (_tmp73_ == 2, "ro_list.size == 2");
447 _tmp75_ = gee_list_get (_tmp74_, 0);
448 _tmp76_ = (gchar*) _tmp75_;
449 _vala_assert (g_strcmp0 (_tmp76_, "one") == 0, "ro_list.get (0) == \"one\"");
452 _tmp78_ = gee_list_get (_tmp77_, 1);
453 _tmp79_ = (gchar*) _tmp78_;
454 _vala_assert (g_strcmp0 (_tmp79_, "two") == 0, "ro_list.get (1) == \"two\"");
457 _tmp81_ = gee_list_iterator_index (_tmp80_);
458 _vala_assert (_tmp81_ == 0, "iterator.index () == 0");
459 _tmp82_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
461 GeeListIterator* _tmp83_;
463 gee_list_iterator_add (_tmp83_, "three");
466 g_test_trap_assert_failed ();
468 _tmp85_ = gee_collection_get_size ((GeeCollection*) _tmp84_);
470 _vala_assert (_tmp86_ == 2, "ro_list.size == 2");
472 _tmp88_ = gee_list_get (_tmp87_, 0);
473 _tmp89_ = (gchar*) _tmp88_;
474 _vala_assert (g_strcmp0 (_tmp89_, "one") == 0, "ro_list.get (0) == \"one\"");
477 _tmp91_ = gee_list_get (_tmp90_, 1);
478 _tmp92_ = (gchar*) _tmp91_;
479 _vala_assert (g_strcmp0 (_tmp92_, "two") == 0, "ro_list.get (1) == \"two\"");
482 _tmp94_ = gee_list_iterator_index (_tmp93_);
483 _vala_assert (_tmp94_ == 0, "iterator.index () == 0");
484 _g_object_unref0 (iterator);
485 _g_object_unref0 (ro_list);
486 _g_object_unref0 (test_list);
490 void read_only_list_tests_test_immutable (ReadOnlyListTests* self) {
491 GeeCollection* _tmp0_;
494 GeeCollection* _tmp2_;
498 gboolean _tmp5_ = FALSE;
503 gboolean _tmp10_ = FALSE;
504 GeeArrayList* _tmp11_;
505 GeeCollection* dummy;
506 GeeCollection* _tmp12_;
507 gboolean _tmp13_ = FALSE;
508 GeeCollection* _tmp14_;
509 gboolean _tmp15_ = FALSE;
510 gboolean _tmp16_ = FALSE;
515 gboolean _tmp22_ = FALSE;
516 gboolean _tmp23_ = FALSE;
521 gboolean _tmp29_ = FALSE;
522 gboolean _tmp30_ = FALSE;
527 gboolean _tmp38_ = FALSE;
528 gboolean _tmp39_ = FALSE;
533 gboolean _tmp46_ = FALSE;
534 gboolean _tmp47_ = FALSE;
539 gboolean _tmp53_ = FALSE;
540 g_return_if_fail (self != NULL);
541 _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection;
542 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL);
544 _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection;
545 _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL);
548 _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one");
549 _vala_assert (_tmp5_, "test_list.add (\"one\")");
551 _tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
553 _vala_assert (_tmp8_ == 1, "ro_list.size == 1");
555 _tmp10_ = gee_collection_contains ((GeeCollection*) _tmp9_, "one");
556 _vala_assert (_tmp10_, "ro_list.contains (\"one\")");
557 _tmp11_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
558 dummy = (GeeCollection*) _tmp11_;
560 _tmp13_ = gee_collection_add (_tmp12_, "one");
561 _vala_assert (_tmp13_, "dummy.add (\"one\")");
563 _tmp15_ = gee_collection_add (_tmp14_, "two");
564 _vala_assert (_tmp15_, "dummy.add (\"two\")");
565 _tmp16_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
569 gee_list_set (_tmp17_, 0, "two");
572 g_test_trap_assert_failed ();
574 _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_);
576 _vala_assert (_tmp20_ == 1, "ro_list.size == 1");
578 _tmp22_ = gee_collection_contains ((GeeCollection*) _tmp21_, "one");
579 _vala_assert (_tmp22_, "ro_list.contains (\"one\")");
580 _tmp23_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
584 gee_list_insert (_tmp24_, 1, "two");
587 g_test_trap_assert_failed ();
589 _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_);
591 _vala_assert (_tmp27_ == 1, "ro_list.size == 1");
593 _tmp29_ = gee_collection_contains ((GeeCollection*) _tmp28_, "one");
594 _vala_assert (_tmp29_, "ro_list.contains (\"one\")");
595 _tmp30_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
598 gpointer _tmp32_ = NULL;
601 _tmp32_ = gee_list_remove_at (_tmp31_, 1);
602 _tmp33_ = (gchar*) _tmp32_;
606 g_test_trap_assert_failed ();
608 _tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_);
610 _vala_assert (_tmp36_ == 1, "ro_list.size == 1");
612 _tmp38_ = gee_collection_contains ((GeeCollection*) _tmp37_, "one");
613 _vala_assert (_tmp38_, "ro_list.contains (\"one\")");
614 _tmp39_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
617 GeeCollection* _tmp41_;
620 gee_list_insert_all (_tmp40_, 1, _tmp41_);
623 g_test_trap_assert_failed ();
625 _tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_);
627 _vala_assert (_tmp44_ == 1, "ro_list.size == 1");
629 _tmp46_ = gee_collection_contains ((GeeCollection*) _tmp45_, "one");
630 _vala_assert (_tmp46_, "ro_list.contains (\"one\")");
631 _tmp47_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
635 gee_list_sort (_tmp48_, NULL, NULL, NULL);
638 g_test_trap_assert_failed ();
640 _tmp50_ = gee_collection_get_size ((GeeCollection*) _tmp49_);
642 _vala_assert (_tmp51_ == 1, "ro_list.size == 1");
644 _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp52_, "one");
645 _vala_assert (_tmp53_, "ro_list.contains (\"one\")");
646 _g_object_unref0 (dummy);
647 _g_object_unref0 (ro_list);
648 _g_object_unref0 (test_list);
652 void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self) {
653 GeeCollection* _tmp0_;
656 GeeCollection* _tmp2_;
659 GeeArrayList* _tmp4_;
660 GeeCollection* dummy;
661 gboolean _tmp5_ = FALSE;
662 gboolean _tmp6_ = FALSE;
669 gboolean _tmp13_ = FALSE;
671 gboolean _tmp15_ = FALSE;
676 gpointer _tmp20_ = NULL;
679 gpointer _tmp23_ = NULL;
681 gpointer _tmp25_ = NULL;
683 gboolean _tmp27_ = FALSE;
688 gpointer _tmp32_ = NULL;
691 gpointer _tmp35_ = NULL;
694 gpointer _tmp38_ = NULL;
696 gpointer _tmp40_ = NULL;
698 gboolean _tmp42_ = FALSE;
703 gboolean _tmp47_ = FALSE;
705 gboolean _tmp49_ = FALSE;
706 gpointer _tmp50_ = NULL;
709 gpointer _tmp53_ = NULL;
711 gpointer _tmp55_ = NULL;
719 g_return_if_fail (self != NULL);
720 _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection;
721 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL);
723 _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection;
724 _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL);
726 _tmp4_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
727 dummy = (GeeCollection*) _tmp4_;
728 _tmp5_ = gee_collection_add (dummy, "one");
729 _vala_assert (_tmp5_, "dummy.add (\"one\")");
730 _tmp6_ = gee_collection_add (dummy, "two");
731 _vala_assert (_tmp6_, "dummy.add (\"two\")");
732 _tmp7_ = gee_traversable_get_element_type ((GeeTraversable*) ro_list);
734 _vala_assert (_tmp8_ == G_TYPE_STRING, "ro_list.element_type == typeof (string)");
735 _tmp9_ = gee_collection_get_size ((GeeCollection*) ro_list);
737 _vala_assert (_tmp10_ == 0, "ro_list.size == 0");
738 _tmp11_ = gee_collection_get_is_empty ((GeeCollection*) ro_list);
740 _vala_assert (_tmp12_, "ro_list.is_empty");
741 _tmp13_ = gee_collection_contains ((GeeCollection*) ro_list, "one");
742 _vala_assert (!_tmp13_, "! ro_list.contains (\"one\")");
743 _tmp14_ = gee_list_index_of (ro_list, "one");
744 _vala_assert (_tmp14_ == (-1), "ro_list.index_of (\"one\") == -1");
745 _tmp15_ = gee_collection_add ((GeeCollection*) test_list, "one");
746 _vala_assert (_tmp15_, "test_list.add (\"one\")");
747 _tmp16_ = gee_collection_get_size ((GeeCollection*) ro_list);
749 _vala_assert (_tmp17_ == 1, "ro_list.size == 1");
750 _tmp18_ = gee_collection_get_is_empty ((GeeCollection*) ro_list);
752 _vala_assert (!_tmp19_, "! ro_list.is_empty");
753 _tmp20_ = gee_list_get (ro_list, 0);
754 _tmp21_ = (gchar*) _tmp20_;
755 _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "ro_list.get (0) == \"one\"");
757 _tmp22_ = gee_list_index_of (ro_list, "one");
758 _vala_assert (_tmp22_ == 0, "ro_list.index_of (\"one\") == 0");
759 _tmp23_ = gee_list_first (ro_list);
760 _tmp24_ = (gchar*) _tmp23_;
761 _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "ro_list.first () == \"one\"");
763 _tmp25_ = gee_list_last (ro_list);
764 _tmp26_ = (gchar*) _tmp25_;
765 _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "ro_list.last () == \"one\"");
767 _tmp27_ = gee_collection_add ((GeeCollection*) test_list, "two");
768 _vala_assert (_tmp27_, "test_list.add (\"two\")");
769 _tmp28_ = gee_collection_get_size ((GeeCollection*) ro_list);
771 _vala_assert (_tmp29_ == 2, "ro_list.size == 2");
772 _tmp30_ = gee_collection_get_is_empty ((GeeCollection*) ro_list);
774 _vala_assert (!_tmp31_, "! ro_list.is_empty");
775 _tmp32_ = gee_list_get (ro_list, 0);
776 _tmp33_ = (gchar*) _tmp32_;
777 _vala_assert (g_strcmp0 (_tmp33_, "one") == 0, "ro_list.get (0) == \"one\"");
779 _tmp34_ = gee_list_index_of (ro_list, "one");
780 _vala_assert (_tmp34_ == 0, "ro_list.index_of (\"one\") == 0");
781 _tmp35_ = gee_list_get (ro_list, 1);
782 _tmp36_ = (gchar*) _tmp35_;
783 _vala_assert (g_strcmp0 (_tmp36_, "two") == 0, "ro_list.get (1) == \"two\"");
785 _tmp37_ = gee_list_index_of (ro_list, "two");
786 _vala_assert (_tmp37_ == 1, "ro_list.index_of (\"two\") == 1");
787 _tmp38_ = gee_list_first (ro_list);
788 _tmp39_ = (gchar*) _tmp38_;
789 _vala_assert (g_strcmp0 (_tmp39_, "one") == 0, "ro_list.first () == \"one\"");
791 _tmp40_ = gee_list_last (ro_list);
792 _tmp41_ = (gchar*) _tmp40_;
793 _vala_assert (g_strcmp0 (_tmp41_, "two") == 0, "ro_list.last () == \"two\"");
795 _tmp42_ = gee_collection_remove ((GeeCollection*) test_list, "one");
796 _vala_assert (_tmp42_, "test_list.remove (\"one\")");
797 _tmp43_ = gee_collection_get_size ((GeeCollection*) ro_list);
799 _vala_assert (_tmp44_ == 1, "ro_list.size == 1");
800 _tmp45_ = gee_collection_get_is_empty ((GeeCollection*) ro_list);
802 _vala_assert (!_tmp46_, "! ro_list.is_empty");
803 _tmp47_ = gee_collection_contains ((GeeCollection*) ro_list, "one");
804 _vala_assert (!_tmp47_, "! ro_list.contains (\"one\")");
805 _tmp48_ = gee_list_index_of (ro_list, "one");
806 _vala_assert (_tmp48_ == (-1), "ro_list.index_of (\"one\") == -1");
807 _tmp49_ = gee_collection_contains ((GeeCollection*) ro_list, "two");
808 _vala_assert (_tmp49_, "ro_list.contains (\"two\")");
809 _tmp50_ = gee_list_get (ro_list, 0);
810 _tmp51_ = (gchar*) _tmp50_;
811 _vala_assert (g_strcmp0 (_tmp51_, "two") == 0, "ro_list.get (0) == \"two\"");
813 _tmp52_ = gee_list_index_of (ro_list, "two");
814 _vala_assert (_tmp52_ == 0, "ro_list.index_of (\"two\") == 0");
815 _tmp53_ = gee_list_first (ro_list);
816 _tmp54_ = (gchar*) _tmp53_;
817 _vala_assert (g_strcmp0 (_tmp54_, "two") == 0, "ro_list.first () == \"two\"");
819 _tmp55_ = gee_list_last (ro_list);
820 _tmp56_ = (gchar*) _tmp55_;
821 _vala_assert (g_strcmp0 (_tmp56_, "two") == 0, "ro_list.last () == \"two\"");
823 gee_collection_clear ((GeeCollection*) test_list);
824 _tmp57_ = gee_collection_get_size ((GeeCollection*) ro_list);
826 _vala_assert (_tmp58_ == 0, "ro_list.size == 0");
827 _tmp59_ = gee_collection_get_is_empty ((GeeCollection*) ro_list);
829 _vala_assert (_tmp60_, "ro_list.is_empty");
830 _tmp61_ = gee_list_index_of (ro_list, "one");
831 _vala_assert (_tmp61_ == (-1), "ro_list.index_of (\"one\") == -1");
832 _tmp62_ = gee_list_index_of (ro_list, "two");
833 _vala_assert (_tmp62_ == (-1), "ro_list.index_of (\"two\") == -1");
834 _g_object_unref0 (dummy);
835 _g_object_unref0 (ro_list);
836 _g_object_unref0 (test_list);
840 static void read_only_list_tests_class_init (ReadOnlyListTestsClass * klass) {
841 read_only_list_tests_parent_class = g_type_class_peek_parent (klass);
842 GEE_TEST_CASE_CLASS (klass)->set_up = read_only_list_tests_real_set_up;
843 GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_list_tests_real_tear_down;
844 READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_list_tests_real_get_ro_view;
848 static void read_only_list_tests_instance_init (ReadOnlyListTests * self) {
852 GType read_only_list_tests_get_type (void) {
853 static volatile gsize read_only_list_tests_type_id__volatile = 0;
854 if (g_once_init_enter (&read_only_list_tests_type_id__volatile)) {
855 static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyListTests), 0, (GInstanceInitFunc) read_only_list_tests_instance_init, NULL };
856 GType read_only_list_tests_type_id;
857 read_only_list_tests_type_id = g_type_register_static (TYPE_READ_ONLY_COLLECTION_TESTS, "ReadOnlyListTests", &g_define_type_info, 0);
858 g_once_init_leave (&read_only_list_tests_type_id__volatile, read_only_list_tests_type_id);
860 return read_only_list_tests_type_id__volatile;