1 /* testtreeset.c generated by valac 0.46.6, the Vala compiler
2 * generated from testtreeset.vala, do not modify */
3
4 /* testtreeset.vala
5 *
6 * Copyright (C) 2009 Didier Villevalois, Julien Peeters
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author:
23 * Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
24 * Julien Peeters <contact@julienpeeters.fr>
25 */
26
27 #include <glib-object.h>
28 #include <gee.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <glib.h>
32
33 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
34 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
35 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
36 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
37 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
38 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
39
40 typedef struct _GeeTestCase GeeTestCase;
41 typedef struct _GeeTestCaseClass GeeTestCaseClass;
42 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
43
44 #define TYPE_COLLECTION_TESTS (collection_tests_get_type ())
45 #define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests))
46 #define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass))
47 #define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS))
48 #define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS))
49 #define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass))
50
51 typedef struct _CollectionTests CollectionTests;
52 typedef struct _CollectionTestsClass CollectionTestsClass;
53 typedef struct _CollectionTestsPrivate CollectionTestsPrivate;
54
55 #define TYPE_SET_TESTS (set_tests_get_type ())
56 #define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests))
57 #define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass))
58 #define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS))
59 #define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS))
60 #define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass))
61
62 typedef struct _SetTests SetTests;
63 typedef struct _SetTestsClass SetTestsClass;
64 typedef struct _SetTestsPrivate SetTestsPrivate;
65
66 #define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ())
67 #define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests))
68 #define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass))
69 #define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS))
70 #define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS))
71 #define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass))
72
73 typedef struct _SortedSetTests SortedSetTests;
74 typedef struct _SortedSetTestsClass SortedSetTestsClass;
75 typedef struct _SortedSetTestsPrivate SortedSetTestsPrivate;
76
77 #define TYPE_BIDIR_SORTED_SET_TESTS (bidir_sorted_set_tests_get_type ())
78 #define BIDIR_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BIDIR_SORTED_SET_TESTS, BidirSortedSetTests))
79 #define BIDIR_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BIDIR_SORTED_SET_TESTS, BidirSortedSetTestsClass))
80 #define IS_BIDIR_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BIDIR_SORTED_SET_TESTS))
81 #define IS_BIDIR_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BIDIR_SORTED_SET_TESTS))
82 #define BIDIR_SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BIDIR_SORTED_SET_TESTS, BidirSortedSetTestsClass))
83
84 typedef struct _BidirSortedSetTests BidirSortedSetTests;
85 typedef struct _BidirSortedSetTestsClass BidirSortedSetTestsClass;
86 typedef struct _BidirSortedSetTestsPrivate BidirSortedSetTestsPrivate;
87
88 #define TYPE_TREE_SET_TESTS (tree_set_tests_get_type ())
89 #define TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_SET_TESTS, TreeSetTests))
90 #define TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_SET_TESTS, TreeSetTestsClass))
91 #define IS_TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_SET_TESTS))
92 #define IS_TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_SET_TESTS))
93 #define TREE_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_SET_TESTS, TreeSetTestsClass))
94
95 typedef struct _TreeSetTests TreeSetTests;
96 typedef struct _TreeSetTestsClass TreeSetTestsClass;
97 typedef struct _TreeSetTestsPrivate TreeSetTestsPrivate;
98 enum {
99 TREE_SET_TESTS_0_PROPERTY,
100 TREE_SET_TESTS_NUM_PROPERTIES
101 };
102 static GParamSpec* tree_set_tests_properties[TREE_SET_TESTS_NUM_PROPERTIES];
103 typedef void (*GeeTestCaseTestMethod) (gpointer user_data);
104 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
105 #define _g_free0(var) (var = (g_free (var), NULL))
106 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
107 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
108 #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
109 #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
110
111 struct _GeeTestCase {
112 GObject parent_instance;
113 GeeTestCasePrivate * priv;
114 };
115
116 struct _GeeTestCaseClass {
117 GObjectClass parent_class;
118 void (*set_up) (GeeTestCase* self);
119 void (*tear_down) (GeeTestCase* self);
120 };
121
122 struct _CollectionTests {
123 GeeTestCase parent_instance;
124 CollectionTestsPrivate * priv;
125 GeeCollection* test_collection;
126 };
127
128 struct _CollectionTestsClass {
129 GeeTestCaseClass parent_class;
130 };
131
132 struct _SetTests {
133 CollectionTests parent_instance;
134 SetTestsPrivate * priv;
135 };
136
137 struct _SetTestsClass {
138 CollectionTestsClass parent_class;
139 void (*test_duplicates_are_ignored) (SetTests* self);
140 };
141
142 struct _SortedSetTests {
143 SetTests parent_instance;
144 SortedSetTestsPrivate * priv;
145 };
146
147 struct _SortedSetTestsClass {
148 SetTestsClass parent_class;
149 };
150
151 struct _BidirSortedSetTests {
152 SortedSetTests parent_instance;
153 BidirSortedSetTestsPrivate * priv;
154 };
155
156 struct _BidirSortedSetTestsClass {
157 SortedSetTestsClass parent_class;
158 };
159
160 struct _TreeSetTests {
161 BidirSortedSetTests parent_instance;
162 TreeSetTestsPrivate * priv;
163 };
164
165 struct _TreeSetTestsClass {
166 BidirSortedSetTestsClass parent_class;
167 };
168
169 static gpointer tree_set_tests_parent_class = NULL;
170
171 GType gee_test_case_get_type (void) G_GNUC_CONST;
172 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeTestCase, g_object_unref)
173 GType collection_tests_get_type (void) G_GNUC_CONST;
174 G_DEFINE_AUTOPTR_CLEANUP_FUNC (CollectionTests, g_object_unref)
175 GType set_tests_get_type (void) G_GNUC_CONST;
176 G_DEFINE_AUTOPTR_CLEANUP_FUNC (SetTests, g_object_unref)
177 GType sorted_set_tests_get_type (void) G_GNUC_CONST;
178 G_DEFINE_AUTOPTR_CLEANUP_FUNC (SortedSetTests, g_object_unref)
179 GType bidir_sorted_set_tests_get_type (void) G_GNUC_CONST;
180 G_DEFINE_AUTOPTR_CLEANUP_FUNC (BidirSortedSetTests, g_object_unref)
181 GType tree_set_tests_get_type (void) G_GNUC_CONST;
182 G_DEFINE_AUTOPTR_CLEANUP_FUNC (TreeSetTests, g_object_unref)
183 TreeSetTests* tree_set_tests_new (void);
184 TreeSetTests* tree_set_tests_construct (GType object_type);
185 BidirSortedSetTests* bidir_sorted_set_tests_construct (GType object_type,
186 const gchar* name);
187 void gee_test_case_add_test (GeeTestCase* self,
188 const gchar* name,
189 GeeTestCaseTestMethod test,
190 gpointer test_target,
191 GDestroyNotify test_target_destroy_notify);
192 void tree_set_tests_test_add_remove (TreeSetTests* self);
193 static void _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self);
194 static void tree_set_tests_real_set_up (GeeTestCase* base);
195 static void tree_set_tests_real_tear_down (GeeTestCase* base);
196 void collection_tests_test_remove_all (CollectionTests* self);
197 static void _vala_array_destroy (gpointer array,
198 gint array_length,
199 GDestroyNotify destroy_func);
200 static void _vala_array_free (gpointer array,
201 gint array_length,
202 GDestroyNotify destroy_func);
203
204 static void
_tree_set_tests_test_add_remove_gee_test_case_test_method(gpointer self)205 _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self)
206 {
207 tree_set_tests_test_add_remove ((TreeSetTests*) self);
208 }
209
210 TreeSetTests*
tree_set_tests_construct(GType object_type)211 tree_set_tests_construct (GType object_type)
212 {
213 TreeSetTests * self = NULL;
214 self = (TreeSetTests*) bidir_sorted_set_tests_construct (object_type, "TreeSet");
215 gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] add and remove", _tree_set_tests_test_add_remove_gee_test_case_test_method, g_object_ref (self), g_object_unref);
216 return self;
217 }
218
219 TreeSetTests*
tree_set_tests_new(void)220 tree_set_tests_new (void)
221 {
222 return tree_set_tests_construct (TYPE_TREE_SET_TESTS);
223 }
224
225 static void
tree_set_tests_real_set_up(GeeTestCase * base)226 tree_set_tests_real_set_up (GeeTestCase* base)
227 {
228 TreeSetTests * self;
229 GeeTreeSet* _tmp0_;
230 self = (TreeSetTests*) base;
231 _tmp0_ = gee_tree_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
232 _g_object_unref0 (((CollectionTests*) self)->test_collection);
233 ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_;
234 }
235
236 static void
tree_set_tests_real_tear_down(GeeTestCase * base)237 tree_set_tests_real_tear_down (GeeTestCase* base)
238 {
239 TreeSetTests * self;
240 self = (TreeSetTests*) base;
241 _g_object_unref0 (((CollectionTests*) self)->test_collection);
242 ((CollectionTests*) self)->test_collection = NULL;
243 }
244
245 static gpointer
_g_object_ref0(gpointer self)246 _g_object_ref0 (gpointer self)
247 {
248 return self ? g_object_ref (self) : NULL;
249 }
250
251 void
tree_set_tests_test_add_remove(TreeSetTests * self)252 tree_set_tests_test_add_remove (TreeSetTests* self)
253 {
254 GeeTreeSet* test_set = NULL;
255 GeeCollection* _tmp0_;
256 GeeTreeSet* _tmp1_;
257 GeeTreeSet* _tmp2_;
258 gchar** to_add = NULL;
259 gchar* _tmp3_;
260 gchar* _tmp4_;
261 gchar* _tmp5_;
262 gchar* _tmp6_;
263 gchar* _tmp7_;
264 gchar* _tmp8_;
265 gchar* _tmp9_;
266 gchar* _tmp10_;
267 gchar* _tmp11_;
268 gchar* _tmp12_;
269 gchar* _tmp13_;
270 gchar* _tmp14_;
271 gchar* _tmp15_;
272 gchar* _tmp16_;
273 gchar* _tmp17_;
274 gchar* _tmp18_;
275 gchar** _tmp19_;
276 gint to_add_length1;
277 gint _to_add_size_;
278 gchar** to_remove = NULL;
279 gchar* _tmp20_;
280 gchar* _tmp21_;
281 gchar* _tmp22_;
282 gchar* _tmp23_;
283 gchar* _tmp24_;
284 gchar* _tmp25_;
285 gchar* _tmp26_;
286 gchar* _tmp27_;
287 gchar* _tmp28_;
288 gchar* _tmp29_;
289 gchar* _tmp30_;
290 gchar* _tmp31_;
291 gchar* _tmp32_;
292 gchar* _tmp33_;
293 gchar* _tmp34_;
294 gchar* _tmp35_;
295 gchar** _tmp36_;
296 gint to_remove_length1;
297 gint _to_remove_size_;
298 gchar** _tmp37_;
299 gint _tmp37__length1;
300 gchar** _tmp45_;
301 gint _tmp45__length1;
302 gchar* _tmp53_;
303 gchar* _tmp54_;
304 gchar* _tmp55_;
305 gchar* _tmp56_;
306 gchar* _tmp57_;
307 gchar* _tmp58_;
308 gchar* _tmp59_;
309 gchar* _tmp60_;
310 gchar* _tmp61_;
311 gchar* _tmp62_;
312 gchar* _tmp63_;
313 gchar* _tmp64_;
314 gchar* _tmp65_;
315 gchar* _tmp66_;
316 gchar* _tmp67_;
317 gchar* _tmp68_;
318 gchar** _tmp69_;
319 gchar* _tmp70_;
320 gchar* _tmp71_;
321 gchar* _tmp72_;
322 gchar* _tmp73_;
323 gchar* _tmp74_;
324 gchar* _tmp75_;
325 gchar* _tmp76_;
326 gchar* _tmp77_;
327 gchar* _tmp78_;
328 gchar* _tmp79_;
329 gchar* _tmp80_;
330 gchar* _tmp81_;
331 gchar* _tmp82_;
332 gchar* _tmp83_;
333 gchar* _tmp84_;
334 gchar* _tmp85_;
335 gchar** _tmp86_;
336 gchar** _tmp87_;
337 gint _tmp87__length1;
338 gchar** _tmp95_;
339 gint _tmp95__length1;
340 g_return_if_fail (self != NULL);
341 _tmp0_ = ((CollectionTests*) self)->test_collection;
342 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL);
343 test_set = _tmp1_;
344 _tmp2_ = test_set;
345 _vala_assert (_tmp2_ != NULL, "test_set != null");
346 collection_tests_test_remove_all ((CollectionTests*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BIDIR_SORTED_SET_TESTS, BidirSortedSetTests));
347 _tmp3_ = g_strdup ("3");
348 _tmp4_ = g_strdup ("10");
349 _tmp5_ = g_strdup ("5");
350 _tmp6_ = g_strdup ("6");
351 _tmp7_ = g_strdup ("13");
352 _tmp8_ = g_strdup ("8");
353 _tmp9_ = g_strdup ("12");
354 _tmp10_ = g_strdup ("11");
355 _tmp11_ = g_strdup ("1");
356 _tmp12_ = g_strdup ("0");
357 _tmp13_ = g_strdup ("9");
358 _tmp14_ = g_strdup ("2");
359 _tmp15_ = g_strdup ("14");
360 _tmp16_ = g_strdup ("7");
361 _tmp17_ = g_strdup ("15");
362 _tmp18_ = g_strdup ("4");
363 _tmp19_ = g_new0 (gchar*, 16 + 1);
364 _tmp19_[0] = _tmp3_;
365 _tmp19_[1] = _tmp4_;
366 _tmp19_[2] = _tmp5_;
367 _tmp19_[3] = _tmp6_;
368 _tmp19_[4] = _tmp7_;
369 _tmp19_[5] = _tmp8_;
370 _tmp19_[6] = _tmp9_;
371 _tmp19_[7] = _tmp10_;
372 _tmp19_[8] = _tmp11_;
373 _tmp19_[9] = _tmp12_;
374 _tmp19_[10] = _tmp13_;
375 _tmp19_[11] = _tmp14_;
376 _tmp19_[12] = _tmp15_;
377 _tmp19_[13] = _tmp16_;
378 _tmp19_[14] = _tmp17_;
379 _tmp19_[15] = _tmp18_;
380 to_add = _tmp19_;
381 to_add_length1 = 16;
382 _to_add_size_ = to_add_length1;
383 _tmp20_ = g_strdup ("11");
384 _tmp21_ = g_strdup ("13");
385 _tmp22_ = g_strdup ("1");
386 _tmp23_ = g_strdup ("12");
387 _tmp24_ = g_strdup ("4");
388 _tmp25_ = g_strdup ("0");
389 _tmp26_ = g_strdup ("2");
390 _tmp27_ = g_strdup ("5");
391 _tmp28_ = g_strdup ("6");
392 _tmp29_ = g_strdup ("3");
393 _tmp30_ = g_strdup ("14");
394 _tmp31_ = g_strdup ("10");
395 _tmp32_ = g_strdup ("7");
396 _tmp33_ = g_strdup ("15");
397 _tmp34_ = g_strdup ("8");
398 _tmp35_ = g_strdup ("9");
399 _tmp36_ = g_new0 (gchar*, 16 + 1);
400 _tmp36_[0] = _tmp20_;
401 _tmp36_[1] = _tmp21_;
402 _tmp36_[2] = _tmp22_;
403 _tmp36_[3] = _tmp23_;
404 _tmp36_[4] = _tmp24_;
405 _tmp36_[5] = _tmp25_;
406 _tmp36_[6] = _tmp26_;
407 _tmp36_[7] = _tmp27_;
408 _tmp36_[8] = _tmp28_;
409 _tmp36_[9] = _tmp29_;
410 _tmp36_[10] = _tmp30_;
411 _tmp36_[11] = _tmp31_;
412 _tmp36_[12] = _tmp32_;
413 _tmp36_[13] = _tmp33_;
414 _tmp36_[14] = _tmp34_;
415 _tmp36_[15] = _tmp35_;
416 to_remove = _tmp36_;
417 to_remove_length1 = 16;
418 _to_remove_size_ = to_remove_length1;
419 _tmp37_ = to_add;
420 _tmp37__length1 = to_add_length1;
421 {
422 gchar** s_collection = NULL;
423 gint s_collection_length1 = 0;
424 gint _s_collection_size_ = 0;
425 gint s_it = 0;
426 s_collection = _tmp37_;
427 s_collection_length1 = _tmp37__length1;
428 for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
429 gchar* _tmp38_;
430 gchar* s = NULL;
431 _tmp38_ = g_strdup (s_collection[s_it]);
432 s = _tmp38_;
433 {
434 GeeTreeSet* _tmp39_;
435 const gchar* _tmp40_;
436 GeeTreeSet* _tmp41_;
437 const gchar* _tmp42_;
438 GeeTreeSet* _tmp43_;
439 const gchar* _tmp44_;
440 _tmp39_ = test_set;
441 _tmp40_ = s;
442 _vala_assert (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp39_, _tmp40_), "!test_set.contains (s)");
443 _tmp41_ = test_set;
444 _tmp42_ = s;
445 _vala_assert (gee_abstract_collection_add ((GeeAbstractCollection*) _tmp41_, _tmp42_), "test_set.add (s)");
446 _tmp43_ = test_set;
447 _tmp44_ = s;
448 _vala_assert (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp43_, _tmp44_), "test_set.contains (s)");
449 _g_free0 (s);
450 }
451 }
452 }
453 _tmp45_ = to_remove;
454 _tmp45__length1 = to_remove_length1;
455 {
456 gchar** s_collection = NULL;
457 gint s_collection_length1 = 0;
458 gint _s_collection_size_ = 0;
459 gint s_it = 0;
460 s_collection = _tmp45_;
461 s_collection_length1 = _tmp45__length1;
462 for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
463 gchar* _tmp46_;
464 gchar* s = NULL;
465 _tmp46_ = g_strdup (s_collection[s_it]);
466 s = _tmp46_;
467 {
468 GeeTreeSet* _tmp47_;
469 const gchar* _tmp48_;
470 GeeTreeSet* _tmp49_;
471 const gchar* _tmp50_;
472 GeeTreeSet* _tmp51_;
473 const gchar* _tmp52_;
474 _tmp47_ = test_set;
475 _tmp48_ = s;
476 _vala_assert (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp47_, _tmp48_), "test_set.contains (s)");
477 _tmp49_ = test_set;
478 _tmp50_ = s;
479 _vala_assert (gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp49_, _tmp50_), "test_set.remove (s)");
480 _tmp51_ = test_set;
481 _tmp52_ = s;
482 _vala_assert (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp51_, _tmp52_), "!test_set.contains (s)");
483 _g_free0 (s);
484 }
485 }
486 }
487 _tmp53_ = g_strdup ("2");
488 _tmp54_ = g_strdup ("9");
489 _tmp55_ = g_strdup ("13");
490 _tmp56_ = g_strdup ("7");
491 _tmp57_ = g_strdup ("12");
492 _tmp58_ = g_strdup ("14");
493 _tmp59_ = g_strdup ("8");
494 _tmp60_ = g_strdup ("1");
495 _tmp61_ = g_strdup ("5");
496 _tmp62_ = g_strdup ("6");
497 _tmp63_ = g_strdup ("11");
498 _tmp64_ = g_strdup ("15");
499 _tmp65_ = g_strdup ("3");
500 _tmp66_ = g_strdup ("10");
501 _tmp67_ = g_strdup ("0");
502 _tmp68_ = g_strdup ("4");
503 _tmp69_ = g_new0 (gchar*, 16 + 1);
504 _tmp69_[0] = _tmp53_;
505 _tmp69_[1] = _tmp54_;
506 _tmp69_[2] = _tmp55_;
507 _tmp69_[3] = _tmp56_;
508 _tmp69_[4] = _tmp57_;
509 _tmp69_[5] = _tmp58_;
510 _tmp69_[6] = _tmp59_;
511 _tmp69_[7] = _tmp60_;
512 _tmp69_[8] = _tmp61_;
513 _tmp69_[9] = _tmp62_;
514 _tmp69_[10] = _tmp63_;
515 _tmp69_[11] = _tmp64_;
516 _tmp69_[12] = _tmp65_;
517 _tmp69_[13] = _tmp66_;
518 _tmp69_[14] = _tmp67_;
519 _tmp69_[15] = _tmp68_;
520 to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL);
521 to_add = _tmp69_;
522 to_add_length1 = 16;
523 _to_add_size_ = to_add_length1;
524 _tmp70_ = g_strdup ("11");
525 _tmp71_ = g_strdup ("10");
526 _tmp72_ = g_strdup ("14");
527 _tmp73_ = g_strdup ("6");
528 _tmp74_ = g_strdup ("13");
529 _tmp75_ = g_strdup ("4");
530 _tmp76_ = g_strdup ("3");
531 _tmp77_ = g_strdup ("15");
532 _tmp78_ = g_strdup ("8");
533 _tmp79_ = g_strdup ("5");
534 _tmp80_ = g_strdup ("7");
535 _tmp81_ = g_strdup ("0");
536 _tmp82_ = g_strdup ("12");
537 _tmp83_ = g_strdup ("2");
538 _tmp84_ = g_strdup ("9");
539 _tmp85_ = g_strdup ("1");
540 _tmp86_ = g_new0 (gchar*, 16 + 1);
541 _tmp86_[0] = _tmp70_;
542 _tmp86_[1] = _tmp71_;
543 _tmp86_[2] = _tmp72_;
544 _tmp86_[3] = _tmp73_;
545 _tmp86_[4] = _tmp74_;
546 _tmp86_[5] = _tmp75_;
547 _tmp86_[6] = _tmp76_;
548 _tmp86_[7] = _tmp77_;
549 _tmp86_[8] = _tmp78_;
550 _tmp86_[9] = _tmp79_;
551 _tmp86_[10] = _tmp80_;
552 _tmp86_[11] = _tmp81_;
553 _tmp86_[12] = _tmp82_;
554 _tmp86_[13] = _tmp83_;
555 _tmp86_[14] = _tmp84_;
556 _tmp86_[15] = _tmp85_;
557 to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL);
558 to_remove = _tmp86_;
559 to_remove_length1 = 16;
560 _to_remove_size_ = to_remove_length1;
561 _tmp87_ = to_add;
562 _tmp87__length1 = to_add_length1;
563 {
564 gchar** s_collection = NULL;
565 gint s_collection_length1 = 0;
566 gint _s_collection_size_ = 0;
567 gint s_it = 0;
568 s_collection = _tmp87_;
569 s_collection_length1 = _tmp87__length1;
570 for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
571 gchar* _tmp88_;
572 gchar* s = NULL;
573 _tmp88_ = g_strdup (s_collection[s_it]);
574 s = _tmp88_;
575 {
576 GeeTreeSet* _tmp89_;
577 const gchar* _tmp90_;
578 GeeTreeSet* _tmp91_;
579 const gchar* _tmp92_;
580 GeeTreeSet* _tmp93_;
581 const gchar* _tmp94_;
582 _tmp89_ = test_set;
583 _tmp90_ = s;
584 _vala_assert (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp89_, _tmp90_), "!test_set.contains (s)");
585 _tmp91_ = test_set;
586 _tmp92_ = s;
587 _vala_assert (gee_abstract_collection_add ((GeeAbstractCollection*) _tmp91_, _tmp92_), "test_set.add (s)");
588 _tmp93_ = test_set;
589 _tmp94_ = s;
590 _vala_assert (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp93_, _tmp94_), "test_set.contains (s)");
591 _g_free0 (s);
592 }
593 }
594 }
595 _tmp95_ = to_remove;
596 _tmp95__length1 = to_remove_length1;
597 {
598 gchar** s_collection = NULL;
599 gint s_collection_length1 = 0;
600 gint _s_collection_size_ = 0;
601 gint s_it = 0;
602 s_collection = _tmp95_;
603 s_collection_length1 = _tmp95__length1;
604 for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
605 gchar* _tmp96_;
606 gchar* s = NULL;
607 _tmp96_ = g_strdup (s_collection[s_it]);
608 s = _tmp96_;
609 {
610 GeeTreeSet* _tmp97_;
611 const gchar* _tmp98_;
612 GeeTreeSet* _tmp99_;
613 const gchar* _tmp100_;
614 GeeTreeSet* _tmp101_;
615 const gchar* _tmp102_;
616 _tmp97_ = test_set;
617 _tmp98_ = s;
618 _vala_assert (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp97_, _tmp98_), "test_set.contains (s)");
619 _tmp99_ = test_set;
620 _tmp100_ = s;
621 _vala_assert (gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp99_, _tmp100_), "test_set.remove (s)");
622 _tmp101_ = test_set;
623 _tmp102_ = s;
624 _vala_assert (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp101_, _tmp102_), "!test_set.contains (s)");
625 _g_free0 (s);
626 }
627 }
628 }
629 to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL);
630 to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL);
631 _g_object_unref0 (test_set);
632 }
633
634 static void
tree_set_tests_class_init(TreeSetTestsClass * klass,gpointer klass_data)635 tree_set_tests_class_init (TreeSetTestsClass * klass,
636 gpointer klass_data)
637 {
638 tree_set_tests_parent_class = g_type_class_peek_parent (klass);
639 ((GeeTestCaseClass *) klass)->set_up = (void (*) (GeeTestCase*)) tree_set_tests_real_set_up;
640 ((GeeTestCaseClass *) klass)->tear_down = (void (*) (GeeTestCase*)) tree_set_tests_real_tear_down;
641 }
642
643 static void
tree_set_tests_instance_init(TreeSetTests * self,gpointer klass)644 tree_set_tests_instance_init (TreeSetTests * self,
645 gpointer klass)
646 {
647 }
648
649 GType
tree_set_tests_get_type(void)650 tree_set_tests_get_type (void)
651 {
652 static volatile gsize tree_set_tests_type_id__volatile = 0;
653 if (g_once_init_enter (&tree_set_tests_type_id__volatile)) {
654 static const GTypeInfo g_define_type_info = { sizeof (TreeSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeSetTests), 0, (GInstanceInitFunc) tree_set_tests_instance_init, NULL };
655 GType tree_set_tests_type_id;
656 tree_set_tests_type_id = g_type_register_static (TYPE_BIDIR_SORTED_SET_TESTS, "TreeSetTests", &g_define_type_info, 0);
657 g_once_init_leave (&tree_set_tests_type_id__volatile, tree_set_tests_type_id);
658 }
659 return tree_set_tests_type_id__volatile;
660 }
661
662 static void
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)663 _vala_array_destroy (gpointer array,
664 gint array_length,
665 GDestroyNotify destroy_func)
666 {
667 if ((array != NULL) && (destroy_func != NULL)) {
668 int i;
669 for (i = 0; i < array_length; i = i + 1) {
670 if (((gpointer*) array)[i] != NULL) {
671 destroy_func (((gpointer*) array)[i]);
672 }
673 }
674 }
675 }
676
677 static void
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)678 _vala_array_free (gpointer array,
679 gint array_length,
680 GDestroyNotify destroy_func)
681 {
682 _vala_array_destroy (array, array_length, destroy_func);
683 g_free (array);
684 }
685
686