1 /* testreadonlycollection.c generated by valac 0.18.0, the Vala compiler
2 * generated from testreadonlycollection.vala, do not modify */
4 /* testreadonlycollection.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>
29 #include <glib-object.h>
35 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
36 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
37 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
38 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
39 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
40 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
42 typedef struct _GeeTestCase GeeTestCase;
43 typedef struct _GeeTestCaseClass GeeTestCaseClass;
44 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
46 #define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ())
47 #define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests))
48 #define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass))
49 #define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS))
50 #define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS))
51 #define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass))
53 typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests;
54 typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass;
55 typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate;
56 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
57 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
60 GObject parent_instance;
61 GeeTestCasePrivate * priv;
64 struct _GeeTestCaseClass {
65 GObjectClass parent_class;
66 void (*set_up) (GeeTestCase* self);
67 void (*tear_down) (GeeTestCase* self);
70 struct _ReadOnlyCollectionTests {
71 GeeTestCase parent_instance;
72 ReadOnlyCollectionTestsPrivate * priv;
73 GeeCollection* test_collection;
74 GeeCollection* ro_collection;
77 struct _ReadOnlyCollectionTestsClass {
78 GeeTestCaseClass parent_class;
79 GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection);
82 typedef void (*GeeTestCaseTestMethod) (void* user_data);
84 static gpointer read_only_collection_tests_parent_class = NULL;
86 GType gee_test_case_get_type (void) G_GNUC_CONST;
87 GType read_only_collection_tests_get_type (void) G_GNUC_CONST;
89 READ_ONLY_COLLECTION_TESTS_DUMMY_PROPERTY
91 ReadOnlyCollectionTests* read_only_collection_tests_new (void);
92 ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type);
93 ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name);
94 ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name);
95 GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name);
96 void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GDestroyNotify test_target_destroy_notify);
97 void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self);
98 static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self);
99 void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self);
100 static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self);
101 void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self);
102 static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self);
103 void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self);
104 static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self);
105 static void read_only_collection_tests_real_set_up (GeeTestCase* base);
106 GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection);
107 static void read_only_collection_tests_real_tear_down (GeeTestCase* base);
108 static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection);
109 static void read_only_collection_tests_finalize (GObject* obj);
112 ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type) {
113 ReadOnlyCollectionTests * self = NULL;
114 self = (ReadOnlyCollectionTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlyCollection");
119 ReadOnlyCollectionTests* read_only_collection_tests_new (void) {
120 return read_only_collection_tests_construct (TYPE_READ_ONLY_COLLECTION_TESTS);
124 static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self) {
125 read_only_collection_tests_test_unique_read_only_view_instance (self);
129 static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) {
130 read_only_collection_tests_test_immutable_iterator (self);
134 static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self) {
135 read_only_collection_tests_test_immutable (self);
139 static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self) {
140 read_only_collection_tests_test_accurate_view (self);
144 ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name) {
145 ReadOnlyCollectionTests * self = NULL;
147 g_return_val_if_fail (name != NULL, NULL);
149 self = (ReadOnlyCollectionTests*) gee_test_case_construct (object_type, _tmp0_);
150 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] unique read-only view instance", _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method, g_object_ref (self), g_object_unref);
151 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable iterator", _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method, g_object_ref (self), g_object_unref);
152 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable", _read_only_collection_tests_test_immutable_gee_test_case_test_method, g_object_ref (self), g_object_unref);
153 gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] accurate view", _read_only_collection_tests_test_accurate_view_gee_test_case_test_method, g_object_ref (self), g_object_unref);
158 ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name) {
159 return read_only_collection_tests_construct_with_name (TYPE_READ_ONLY_COLLECTION_TESTS, name);
163 static void read_only_collection_tests_real_set_up (GeeTestCase* base) {
164 ReadOnlyCollectionTests * self;
165 GeeHashMultiSet* _tmp0_;
166 GeeCollection* _tmp1_;
167 GeeCollection* _tmp2_ = NULL;
168 self = (ReadOnlyCollectionTests*) base;
169 _tmp0_ = gee_hash_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL);
170 _g_object_unref0 (self->test_collection);
171 self->test_collection = (GeeCollection*) _tmp0_;
172 _tmp1_ = self->test_collection;
173 _tmp2_ = read_only_collection_tests_get_ro_view (self, _tmp1_);
174 _g_object_unref0 (self->ro_collection);
175 self->ro_collection = _tmp2_;
179 static void read_only_collection_tests_real_tear_down (GeeTestCase* base) {
180 ReadOnlyCollectionTests * self;
181 self = (ReadOnlyCollectionTests*) base;
182 _g_object_unref0 (self->test_collection);
183 self->test_collection = NULL;
184 _g_object_unref0 (self->ro_collection);
185 self->ro_collection = NULL;
189 static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) {
190 GeeCollection* result = NULL;
191 GeeCollection* _tmp0_;
192 GeeCollection* _tmp1_;
193 GeeCollection* _tmp2_;
194 g_return_val_if_fail (collection != NULL, NULL);
196 _tmp1_ = gee_collection_get_read_only_view (_tmp0_);
203 GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) {
204 g_return_val_if_fail (self != NULL, NULL);
205 return READ_ONLY_COLLECTION_TESTS_GET_CLASS (self)->get_ro_view (self, collection);
209 void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self) {
210 GeeCollection* _tmp0_;
211 GeeCollection* _tmp1_ = NULL;
212 GeeCollection* another_ro_collection;
213 GeeCollection* _tmp2_;
214 GeeCollection* _tmp3_;
215 GeeCollection* _tmp4_;
217 GeeCollection* _tmp6_;
218 gconstpointer _tmp7_ = NULL;
219 GeeCollection* _tmp8_;
220 GeeCollection* _tmp9_ = NULL;
221 GeeCollection* _tmp10_;
222 gconstpointer _tmp11_ = NULL;
223 GeeCollection* _tmp12_;
224 GeeCollection* _tmp13_;
225 GeeCollection* _tmp14_ = NULL;
226 GeeCollection* _tmp15_;
227 g_return_if_fail (self != NULL);
228 _tmp0_ = self->test_collection;
229 _tmp1_ = read_only_collection_tests_get_ro_view (self, _tmp0_);
230 another_ro_collection = _tmp1_;
231 _tmp2_ = self->ro_collection;
232 _tmp3_ = another_ro_collection;
233 _vala_assert (_tmp2_ == _tmp3_, "ro_collection == another_ro_collection");
234 _tmp4_ = self->ro_collection;
235 _tmp5_ = g_object_new (G_TYPE_OBJECT, NULL);
236 g_object_set_data_full ((GObject*) _tmp4_, "marker", _tmp5_, g_object_unref);
237 _tmp6_ = another_ro_collection;
238 _tmp7_ = g_object_get_data ((GObject*) _tmp6_, "marker");
239 _vala_assert (((GObject*) _tmp7_) != NULL, "another_ro_collection.get_data<Object> (\"marker\") != null");
240 _g_object_unref0 (another_ro_collection);
241 another_ro_collection = NULL;
242 _g_object_unref0 (self->ro_collection);
243 self->ro_collection = NULL;
244 _tmp8_ = self->test_collection;
245 _tmp9_ = read_only_collection_tests_get_ro_view (self, _tmp8_);
246 _g_object_unref0 (another_ro_collection);
247 another_ro_collection = _tmp9_;
248 _tmp10_ = another_ro_collection;
249 _tmp11_ = g_object_get_data ((GObject*) _tmp10_, "marker");
250 _vala_assert (((GObject*) _tmp11_) == NULL, "another_ro_collection.get_data<Object> (\"marker\") == null");
251 _tmp12_ = another_ro_collection;
252 _tmp13_ = another_ro_collection;
253 _tmp14_ = read_only_collection_tests_get_ro_view (self, _tmp13_);
255 _vala_assert (_tmp12_ == _tmp15_, "another_ro_collection == get_ro_view (another_ro_collection)");
256 _g_object_unref0 (_tmp15_);
257 _g_object_unref0 (another_ro_collection);
261 void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self) {
262 GeeCollection* _tmp0_;
263 gboolean _tmp1_ = FALSE;
264 GeeCollection* _tmp2_;
265 gboolean _tmp3_ = FALSE;
266 GeeCollection* _tmp4_;
269 GeeCollection* _tmp7_;
270 gboolean _tmp8_ = FALSE;
271 GeeCollection* _tmp9_;
272 gboolean _tmp10_ = FALSE;
273 GeeCollection* _tmp11_;
274 GeeIterator* _tmp12_ = NULL;
275 GeeIterator* iterator;
280 GeeIterator* _tmp27_;
281 gboolean _tmp28_ = FALSE;
282 GeeIterator* _tmp29_;
283 gboolean _tmp30_ = FALSE;
284 GeeCollection* _tmp31_;
285 GeeIterator* _tmp32_ = NULL;
286 GeeIterator* _tmp33_;
287 gboolean _tmp34_ = FALSE;
288 GeeIterator* _tmp35_;
289 gboolean _tmp36_ = FALSE;
290 GeeIterator* _tmp37_;
293 gboolean _tmp40_ = FALSE;
294 GeeCollection* _tmp42_;
297 GeeCollection* _tmp45_;
298 gboolean _tmp46_ = FALSE;
299 GeeCollection* _tmp47_;
300 gboolean _tmp48_ = FALSE;
301 g_return_if_fail (self != NULL);
302 _tmp0_ = self->test_collection;
303 _tmp1_ = gee_collection_add (_tmp0_, "one");
304 _vala_assert (_tmp1_, "test_collection.add (\"one\")");
305 _tmp2_ = self->test_collection;
306 _tmp3_ = gee_collection_add (_tmp2_, "two");
307 _vala_assert (_tmp3_, "test_collection.add (\"two\")");
308 _tmp4_ = self->ro_collection;
309 _tmp5_ = gee_collection_get_size (_tmp4_);
311 _vala_assert (_tmp6_ == 2, "ro_collection.size == 2");
312 _tmp7_ = self->ro_collection;
313 _tmp8_ = gee_collection_contains (_tmp7_, "one");
314 _vala_assert (_tmp8_, "ro_collection.contains (\"one\")");
315 _tmp9_ = self->ro_collection;
316 _tmp10_ = gee_collection_contains (_tmp9_, "two");
317 _vala_assert (_tmp10_, "ro_collection.contains (\"two\")");
318 _tmp11_ = self->ro_collection;
319 _tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_);
324 GeeIterator* _tmp13_;
325 gboolean _tmp14_ = FALSE;
326 GeeIterator* _tmp15_;
329 GeeIterator* _tmp18_;
330 gpointer _tmp19_ = NULL;
333 static GQuark _tmp21_label0 = 0;
334 static GQuark _tmp21_label1 = 0;
336 _tmp14_ = gee_iterator_next (_tmp13_);
341 _tmp16_ = gee_iterator_get_valid (_tmp15_);
343 _vala_assert (_tmp17_, "iterator.valid");
345 _tmp19_ = gee_iterator_get (_tmp18_);
346 _tmp20_ = (gchar*) _tmp19_;
347 _tmp22_ = (NULL == _tmp20_) ? 0 : g_quark_from_string (_tmp20_);
349 if (_tmp22_ == ((0 != _tmp21_label0) ? _tmp21_label0 : (_tmp21_label0 = g_quark_from_static_string ("one")))) {
355 _vala_assert (!_tmp23_, "! one_found");
360 } else if (_tmp22_ == ((0 != _tmp21_label1) ? _tmp21_label1 : (_tmp21_label1 = g_quark_from_static_string ("two")))) {
366 _vala_assert (!_tmp24_, "! two_found");
375 g_assert_not_reached ();
381 _vala_assert (_tmp25_, "one_found");
383 _vala_assert (_tmp26_, "two_found");
385 _tmp28_ = gee_iterator_has_next (_tmp27_);
386 _vala_assert (!_tmp28_, "! iterator.has_next ()");
388 _tmp30_ = gee_iterator_next (_tmp29_);
389 _vala_assert (!_tmp30_, "! iterator.next ()");
390 _tmp31_ = self->ro_collection;
391 _tmp32_ = gee_iterable_iterator ((GeeIterable*) _tmp31_);
392 _g_object_unref0 (iterator);
395 _tmp34_ = gee_iterator_has_next (_tmp33_);
396 _vala_assert (_tmp34_, "iterator.has_next ()");
398 _tmp36_ = gee_iterator_next (_tmp35_);
399 _vala_assert (_tmp36_, "iterator.next ()");
401 _tmp38_ = gee_iterator_get_read_only (_tmp37_);
403 _vala_assert (_tmp39_, "iterator.read_only");
404 _tmp40_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
406 GeeIterator* _tmp41_;
408 gee_iterator_remove (_tmp41_);
411 g_test_trap_assert_failed ();
412 _tmp42_ = self->ro_collection;
413 _tmp43_ = gee_collection_get_size (_tmp42_);
415 _vala_assert (_tmp44_ == 2, "ro_collection.size == 2");
416 _tmp45_ = self->ro_collection;
417 _tmp46_ = gee_collection_contains (_tmp45_, "one");
418 _vala_assert (_tmp46_, "ro_collection.contains (\"one\")");
419 _tmp47_ = self->ro_collection;
420 _tmp48_ = gee_collection_contains (_tmp47_, "two");
421 _vala_assert (_tmp48_, "ro_collection.contains (\"two\")");
422 _g_object_unref0 (iterator);
426 void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self) {
427 GeeCollection* _tmp0_;
428 gboolean _tmp1_ = FALSE;
429 GeeCollection* _tmp2_;
432 GeeCollection* _tmp5_;
433 gboolean _tmp6_ = FALSE;
434 GeeArrayList* _tmp7_;
435 GeeCollection* dummy;
436 GeeCollection* _tmp8_;
437 gboolean _tmp9_ = FALSE;
438 GeeCollection* _tmp10_;
439 gboolean _tmp11_ = FALSE;
440 gboolean _tmp12_ = FALSE;
441 GeeCollection* _tmp15_;
444 GeeCollection* _tmp18_;
445 gboolean _tmp19_ = FALSE;
446 gboolean _tmp20_ = FALSE;
447 GeeCollection* _tmp22_;
450 GeeCollection* _tmp25_;
451 gboolean _tmp26_ = FALSE;
452 gboolean _tmp27_ = FALSE;
453 GeeCollection* _tmp30_;
456 GeeCollection* _tmp33_;
457 gboolean _tmp34_ = FALSE;
458 gboolean _tmp35_ = FALSE;
459 GeeCollection* _tmp39_;
462 GeeCollection* _tmp42_;
463 gboolean _tmp43_ = FALSE;
464 gboolean _tmp44_ = FALSE;
465 GeeCollection* _tmp48_;
468 GeeCollection* _tmp51_;
469 gboolean _tmp52_ = FALSE;
470 GeeCollection* _tmp53_;
471 gboolean _tmp54_ = FALSE;
472 gboolean _tmp55_ = FALSE;
473 GeeCollection* _tmp59_;
476 GeeCollection* _tmp62_;
477 gboolean _tmp63_ = FALSE;
478 g_return_if_fail (self != NULL);
479 _tmp0_ = self->test_collection;
480 _tmp1_ = gee_collection_add (_tmp0_, "one");
481 _vala_assert (_tmp1_, "test_collection.add (\"one\")");
482 _tmp2_ = self->ro_collection;
483 _tmp3_ = gee_collection_get_size (_tmp2_);
485 _vala_assert (_tmp4_ == 1, "ro_collection.size == 1");
486 _tmp5_ = self->ro_collection;
487 _tmp6_ = gee_collection_contains (_tmp5_, "one");
488 _vala_assert (_tmp6_, "ro_collection.contains (\"one\")");
489 _tmp7_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
490 dummy = (GeeCollection*) _tmp7_;
492 _tmp9_ = gee_collection_add (_tmp8_, "one");
493 _vala_assert (_tmp9_, "dummy.add (\"one\")");
495 _tmp11_ = gee_collection_add (_tmp10_, "two");
496 _vala_assert (_tmp11_, "dummy.add (\"two\")");
497 _tmp12_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
499 GeeCollection* _tmp13_;
500 gboolean _tmp14_ = FALSE;
501 _tmp13_ = self->ro_collection;
502 _tmp14_ = gee_collection_add (_tmp13_, "two");
503 _vala_assert (_tmp14_, "ro_collection.add (\"two\")");
506 g_test_trap_assert_failed ();
507 _tmp15_ = self->ro_collection;
508 _tmp16_ = gee_collection_get_size (_tmp15_);
510 _vala_assert (_tmp17_ == 1, "ro_collection.size == 1");
511 _tmp18_ = self->ro_collection;
512 _tmp19_ = gee_collection_contains (_tmp18_, "one");
513 _vala_assert (_tmp19_, "ro_collection.contains (\"one\")");
514 _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
516 GeeCollection* _tmp21_;
517 _tmp21_ = self->ro_collection;
518 gee_collection_clear (_tmp21_);
521 g_test_trap_assert_failed ();
522 _tmp22_ = self->ro_collection;
523 _tmp23_ = gee_collection_get_size (_tmp22_);
525 _vala_assert (_tmp24_ == 1, "ro_collection.size == 1");
526 _tmp25_ = self->ro_collection;
527 _tmp26_ = gee_collection_contains (_tmp25_, "one");
528 _vala_assert (_tmp26_, "ro_collection.contains (\"one\")");
529 _tmp27_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
531 GeeCollection* _tmp28_;
532 gboolean _tmp29_ = FALSE;
533 _tmp28_ = self->ro_collection;
534 _tmp29_ = gee_collection_remove (_tmp28_, "one");
535 _vala_assert (_tmp29_, "ro_collection.remove (\"one\")");
538 g_test_trap_assert_failed ();
539 _tmp30_ = self->ro_collection;
540 _tmp31_ = gee_collection_get_size (_tmp30_);
542 _vala_assert (_tmp32_ == 1, "ro_collection.size == 1");
543 _tmp33_ = self->ro_collection;
544 _tmp34_ = gee_collection_contains (_tmp33_, "one");
545 _vala_assert (_tmp34_, "ro_collection.contains (\"one\")");
546 _tmp35_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
548 GeeCollection* _tmp36_;
549 GeeCollection* _tmp37_;
550 gboolean _tmp38_ = FALSE;
551 _tmp36_ = self->ro_collection;
553 _tmp38_ = gee_collection_add_all (_tmp36_, _tmp37_);
554 _vala_assert (_tmp38_, "ro_collection.add_all (dummy)");
557 g_test_trap_assert_failed ();
558 _tmp39_ = self->ro_collection;
559 _tmp40_ = gee_collection_get_size (_tmp39_);
561 _vala_assert (_tmp41_ == 1, "ro_collection.size == 1");
562 _tmp42_ = self->ro_collection;
563 _tmp43_ = gee_collection_contains (_tmp42_, "one");
564 _vala_assert (_tmp43_, "ro_collection.contains (\"one\")");
565 _tmp44_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
567 GeeCollection* _tmp45_;
568 GeeCollection* _tmp46_;
569 gboolean _tmp47_ = FALSE;
570 _tmp45_ = self->ro_collection;
572 _tmp47_ = gee_collection_remove_all (_tmp45_, _tmp46_);
573 _vala_assert (_tmp47_, "ro_collection.remove_all (dummy)");
576 g_test_trap_assert_failed ();
577 _tmp48_ = self->ro_collection;
578 _tmp49_ = gee_collection_get_size (_tmp48_);
580 _vala_assert (_tmp50_ == 1, "ro_collection.size == 1");
581 _tmp51_ = self->ro_collection;
582 _tmp52_ = gee_collection_contains (_tmp51_, "one");
583 _vala_assert (_tmp52_, "ro_collection.contains (\"one\")");
585 _tmp54_ = gee_collection_remove (_tmp53_, "one");
586 _vala_assert (_tmp54_, "dummy.remove (\"one\")");
587 _tmp55_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR);
589 GeeCollection* _tmp56_;
590 GeeCollection* _tmp57_;
591 gboolean _tmp58_ = FALSE;
592 _tmp56_ = self->ro_collection;
594 _tmp58_ = gee_collection_retain_all (_tmp56_, _tmp57_);
595 _vala_assert (_tmp58_, "ro_collection.retain_all (dummy)");
598 g_test_trap_assert_failed ();
599 _tmp59_ = self->ro_collection;
600 _tmp60_ = gee_collection_get_size (_tmp59_);
602 _vala_assert (_tmp61_ == 1, "ro_collection.size == 1");
603 _tmp62_ = self->ro_collection;
604 _tmp63_ = gee_collection_contains (_tmp62_, "one");
605 _vala_assert (_tmp63_, "ro_collection.contains (\"one\")");
606 _g_object_unref0 (dummy);
610 void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self) {
611 GeeArrayList* _tmp0_;
612 GeeCollection* dummy;
613 gboolean _tmp1_ = FALSE;
614 gboolean _tmp2_ = FALSE;
615 GeeCollection* _tmp3_;
618 GeeCollection* _tmp6_;
621 GeeCollection* _tmp9_;
624 GeeCollection* _tmp12_;
625 gboolean _tmp13_ = FALSE;
626 GeeCollection* _tmp14_;
627 gboolean _tmp15_ = FALSE;
628 GeeCollection* _tmp16_;
631 GeeCollection* _tmp19_;
634 GeeCollection* _tmp22_;
635 gboolean _tmp23_ = FALSE;
636 GeeCollection* _tmp24_;
637 gboolean _tmp25_ = FALSE;
638 GeeCollection* _tmp26_;
641 GeeCollection* _tmp29_;
644 GeeCollection* _tmp32_;
645 gboolean _tmp33_ = FALSE;
646 GeeCollection* _tmp34_;
647 gboolean _tmp35_ = FALSE;
648 GeeCollection* _tmp36_;
649 gboolean _tmp37_ = FALSE;
650 GeeCollection* _tmp38_;
651 gboolean _tmp39_ = FALSE;
652 GeeCollection* _tmp40_;
655 GeeCollection* _tmp43_;
658 GeeCollection* _tmp46_;
659 gboolean _tmp47_ = FALSE;
660 GeeCollection* _tmp48_;
661 gboolean _tmp49_ = FALSE;
662 GeeCollection* _tmp50_;
663 gboolean _tmp51_ = FALSE;
664 GeeCollection* _tmp52_;
665 GeeCollection* _tmp53_;
668 GeeCollection* _tmp56_;
671 GeeCollection* _tmp59_;
672 gboolean _tmp60_ = FALSE;
673 GeeCollection* _tmp61_;
674 gboolean _tmp62_ = FALSE;
675 g_return_if_fail (self != NULL);
676 _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
677 dummy = (GeeCollection*) _tmp0_;
678 _tmp1_ = gee_collection_add (dummy, "one");
679 _vala_assert (_tmp1_, "dummy.add (\"one\")");
680 _tmp2_ = gee_collection_add (dummy, "two");
681 _vala_assert (_tmp2_, "dummy.add (\"two\")");
682 _tmp3_ = self->ro_collection;
683 _tmp4_ = gee_traversable_get_element_type ((GeeTraversable*) _tmp3_);
685 _vala_assert (_tmp5_ == G_TYPE_STRING, "ro_collection.element_type == typeof (string)");
686 _tmp6_ = self->ro_collection;
687 _tmp7_ = gee_collection_get_size (_tmp6_);
689 _vala_assert (_tmp8_ == 0, "ro_collection.size == 0");
690 _tmp9_ = self->ro_collection;
691 _tmp10_ = gee_collection_get_is_empty (_tmp9_);
693 _vala_assert (_tmp11_, "ro_collection.is_empty");
694 _tmp12_ = self->ro_collection;
695 _tmp13_ = gee_collection_contains (_tmp12_, "one");
696 _vala_assert (!_tmp13_, "! ro_collection.contains (\"one\")");
697 _tmp14_ = self->test_collection;
698 _tmp15_ = gee_collection_add (_tmp14_, "one");
699 _vala_assert (_tmp15_, "test_collection.add (\"one\")");
700 _tmp16_ = self->ro_collection;
701 _tmp17_ = gee_collection_get_size (_tmp16_);
703 _vala_assert (_tmp18_ == 1, "ro_collection.size == 1");
704 _tmp19_ = self->ro_collection;
705 _tmp20_ = gee_collection_get_is_empty (_tmp19_);
707 _vala_assert (!_tmp21_, "! ro_collection.is_empty");
708 _tmp22_ = self->ro_collection;
709 _tmp23_ = gee_collection_contains (_tmp22_, "one");
710 _vala_assert (_tmp23_, "ro_collection.contains (\"one\")");
711 _tmp24_ = self->test_collection;
712 _tmp25_ = gee_collection_add (_tmp24_, "two");
713 _vala_assert (_tmp25_, "test_collection.add (\"two\")");
714 _tmp26_ = self->ro_collection;
715 _tmp27_ = gee_collection_get_size (_tmp26_);
717 _vala_assert (_tmp28_ == 2, "ro_collection.size == 2");
718 _tmp29_ = self->ro_collection;
719 _tmp30_ = gee_collection_get_is_empty (_tmp29_);
721 _vala_assert (!_tmp31_, "! ro_collection.is_empty");
722 _tmp32_ = self->ro_collection;
723 _tmp33_ = gee_collection_contains (_tmp32_, "one");
724 _vala_assert (_tmp33_, "ro_collection.contains (\"one\")");
725 _tmp34_ = self->ro_collection;
726 _tmp35_ = gee_collection_contains (_tmp34_, "two");
727 _vala_assert (_tmp35_, "ro_collection.contains (\"two\")");
728 _tmp36_ = self->ro_collection;
729 _tmp37_ = gee_collection_contains_all (_tmp36_, dummy);
730 _vala_assert (_tmp37_, "ro_collection.contains_all (dummy)");
731 _tmp38_ = self->test_collection;
732 _tmp39_ = gee_collection_remove (_tmp38_, "one");
733 _vala_assert (_tmp39_, "test_collection.remove (\"one\")");
734 _tmp40_ = self->ro_collection;
735 _tmp41_ = gee_collection_get_size (_tmp40_);
737 _vala_assert (_tmp42_ == 1, "ro_collection.size == 1");
738 _tmp43_ = self->ro_collection;
739 _tmp44_ = gee_collection_get_is_empty (_tmp43_);
741 _vala_assert (!_tmp45_, "! ro_collection.is_empty");
742 _tmp46_ = self->ro_collection;
743 _tmp47_ = gee_collection_contains (_tmp46_, "one");
744 _vala_assert (!_tmp47_, "! ro_collection.contains (\"one\")");
745 _tmp48_ = self->ro_collection;
746 _tmp49_ = gee_collection_contains (_tmp48_, "two");
747 _vala_assert (_tmp49_, "ro_collection.contains (\"two\")");
748 _tmp50_ = self->ro_collection;
749 _tmp51_ = gee_collection_contains_all (_tmp50_, dummy);
750 _vala_assert (!_tmp51_, "! ro_collection.contains_all (dummy)");
751 _tmp52_ = self->test_collection;
752 gee_collection_clear (_tmp52_);
753 _tmp53_ = self->ro_collection;
754 _tmp54_ = gee_collection_get_size (_tmp53_);
756 _vala_assert (_tmp55_ == 0, "ro_collection.size == 0");
757 _tmp56_ = self->ro_collection;
758 _tmp57_ = gee_collection_get_is_empty (_tmp56_);
760 _vala_assert (_tmp58_, "ro_collection.is_empty");
761 _tmp59_ = self->ro_collection;
762 _tmp60_ = gee_collection_contains (_tmp59_, "one");
763 _vala_assert (!_tmp60_, "! ro_collection.contains (\"one\")");
764 _tmp61_ = self->ro_collection;
765 _tmp62_ = gee_collection_contains (_tmp61_, "two");
766 _vala_assert (!_tmp62_, "! ro_collection.contains (\"two\")");
767 _g_object_unref0 (dummy);
771 static void read_only_collection_tests_class_init (ReadOnlyCollectionTestsClass * klass) {
772 read_only_collection_tests_parent_class = g_type_class_peek_parent (klass);
773 GEE_TEST_CASE_CLASS (klass)->set_up = read_only_collection_tests_real_set_up;
774 GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_collection_tests_real_tear_down;
775 READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_collection_tests_real_get_ro_view;
776 G_OBJECT_CLASS (klass)->finalize = read_only_collection_tests_finalize;
780 static void read_only_collection_tests_instance_init (ReadOnlyCollectionTests * self) {
784 static void read_only_collection_tests_finalize (GObject* obj) {
785 ReadOnlyCollectionTests * self;
786 self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests);
787 _g_object_unref0 (self->test_collection);
788 _g_object_unref0 (self->ro_collection);
789 G_OBJECT_CLASS (read_only_collection_tests_parent_class)->finalize (obj);
793 GType read_only_collection_tests_get_type (void) {
794 static volatile gsize read_only_collection_tests_type_id__volatile = 0;
795 if (g_once_init_enter (&read_only_collection_tests_type_id__volatile)) {
796 static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyCollectionTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_collection_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyCollectionTests), 0, (GInstanceInitFunc) read_only_collection_tests_instance_init, NULL };
797 GType read_only_collection_tests_type_id;
798 read_only_collection_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ReadOnlyCollectionTests", &g_define_type_info, 0);
799 g_once_init_leave (&read_only_collection_tests_type_id__volatile, read_only_collection_tests_type_id);
801 return read_only_collection_tests_type_id__volatile;