summaryrefslogtreecommitdiff
path: root/tests/control-flow/foreach.c-expected
blob: c402e1c12deefbef834cd44e3634be3d8d3bf132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
/* control_flow_foreach.c generated by valac, the Vala compiler
 * generated from control_flow_foreach.vala, do not modify */

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_EXTERN)
#if defined(_WIN32) || defined(__CYGWIN__)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#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; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

VALA_EXTERN void test_owned (GValueArray* array);
VALA_EXTERN void test_unowned (GValueArray* array);
VALA_EXTERN void test_foreach_gvaluearray (void);
VALA_EXTERN void test_generic_array_owned (GPtrArray* array);
static GValue* _g_value_dup (GValue* self);
static void _vala_GValue_free (GValue* self);
VALA_EXTERN void test_generic_array_unowned (GPtrArray* array);
VALA_EXTERN void test_foreach_genericarray (void);
static void __vala_GValue_free0_ (gpointer var);
VALA_EXTERN void test_gsequence_owned (GSequence* sequence);
VALA_EXTERN void test_gsequence_unowned (GSequence* sequence);
VALA_EXTERN void test_foreach_gsequence (void);
VALA_EXTERN void test_garray_owned (GArray* array);
VALA_EXTERN void test_garray_unowned (GArray* array);
VALA_EXTERN void test_foreach_garray (void);
static void _vala_GValue_free_function_content_of (gpointer data);
VALA_EXTERN void test_foreach_multidim_array (void);
VALA_EXTERN void test_foreach_const_array (void);
VALA_EXTERN void test_foreach_slice_array (void);
static void _vala_main (void);

const gint FOO[6] = {1, 2, 3, 4, 5, 6};
const gint BAR[6] = {6, 5, 4, 3, 2, 1};

void
test_owned (GValueArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GValueArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->n_values; item_index = item_index + 1) {
			GValue _tmp0_;
			GValue _tmp1_ = {0};
			GValue item = {0};
			_tmp0_ = *g_value_array_get_nth (item_collection, item_index);
			if (G_IS_VALUE (&_tmp0_)) {
				g_value_init (&_tmp1_, G_VALUE_TYPE (&_tmp0_));
				g_value_copy (&_tmp0_, &_tmp1_);
			} else {
				_tmp1_ = _tmp0_;
			}
			item = _tmp1_;
			{
				guint _tmp2_;
				_tmp2_ = i;
				i = _tmp2_ + 1;
				G_IS_VALUE (&item) ? (g_value_unset (&item), NULL) : NULL;
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_unowned (GValueArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GValueArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->n_values; item_index = item_index + 1) {
			GValue item = {0};
			item = *g_value_array_get_nth (item_collection, item_index);
			{
				guint _tmp0_;
				_tmp0_ = i;
				i = _tmp0_ + 1;
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_foreach_gvaluearray (void)
{
	GValue value = {0};
	GValueArray* array = NULL;
	GValueArray* _tmp0_;
	GValue _tmp1_ = {0};
	GValue _tmp2_;
	GValue _tmp3_ = {0};
	GValue _tmp4_;
	GValue _tmp5_ = {0};
	GValue _tmp6_;
	_tmp0_ = g_value_array_new ((guint) 3);
	array = _tmp0_;
	g_value_init (&_tmp1_, G_TYPE_INT);
	g_value_set_int (&_tmp1_, 1);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp1_;
	_tmp2_ = value;
	g_value_array_append (array, &_tmp2_);
	g_value_init (&_tmp3_, G_TYPE_DOUBLE);
	g_value_set_double (&_tmp3_, 2.0);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp3_;
	_tmp4_ = value;
	g_value_array_append (array, &_tmp4_);
	g_value_init (&_tmp5_, G_TYPE_STRING);
	g_value_set_string (&_tmp5_, "three");
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp5_;
	_tmp6_ = value;
	g_value_array_append (array, &_tmp6_);
	test_owned (array);
	test_unowned (array);
	_g_value_array_free0 (array);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}

static GValue*
_g_value_dup (GValue* self)
{
	return g_boxed_copy (G_TYPE_VALUE, self);
}

static gpointer
__g_value_dup0 (gpointer self)
{
	return self ? _g_value_dup (self) : NULL;
}

static void
_vala_GValue_free (GValue* self)
{
	g_boxed_free (G_TYPE_VALUE, self);
}

void
test_generic_array_owned (GPtrArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GPtrArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
			GValue* _tmp0_;
			GValue* item = NULL;
			_tmp0_ = __g_value_dup0 (g_ptr_array_index (item_collection, item_index));
			item = _tmp0_;
			{
				guint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
				__vala_GValue_free0 (item);
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_generic_array_unowned (GPtrArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GPtrArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
			GValue* item = NULL;
			item = g_ptr_array_index (item_collection, item_index);
			{
				guint _tmp0_;
				_tmp0_ = i;
				i = _tmp0_ + 1;
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

static void
__vala_GValue_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
}

void
test_foreach_genericarray (void)
{
	GValue value = {0};
	GPtrArray* array = NULL;
	GPtrArray* _tmp0_;
	GValue _tmp1_ = {0};
	GValue _tmp2_;
	GValue _tmp3_;
	GValue* _tmp4_;
	GValue _tmp5_ = {0};
	GValue _tmp6_;
	GValue _tmp7_;
	GValue* _tmp8_;
	GValue _tmp9_ = {0};
	GValue _tmp10_;
	GValue _tmp11_;
	GValue* _tmp12_;
	_tmp0_ = g_ptr_array_new_full ((guint) 0, __vala_GValue_free0_);
	array = _tmp0_;
	g_value_init (&_tmp1_, G_TYPE_INT);
	g_value_set_int (&_tmp1_, 1);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp1_;
	_tmp2_ = value;
	_tmp3_ = _tmp2_;
	_tmp4_ = __g_value_dup0 (&_tmp3_);
	g_ptr_array_add (array, _tmp4_);
	g_value_init (&_tmp5_, G_TYPE_DOUBLE);
	g_value_set_double (&_tmp5_, 2.0);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp5_;
	_tmp6_ = value;
	_tmp7_ = _tmp6_;
	_tmp8_ = __g_value_dup0 (&_tmp7_);
	g_ptr_array_add (array, _tmp8_);
	g_value_init (&_tmp9_, G_TYPE_STRING);
	g_value_set_string (&_tmp9_, "three");
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp9_;
	_tmp10_ = value;
	_tmp11_ = _tmp10_;
	_tmp12_ = __g_value_dup0 (&_tmp11_);
	g_ptr_array_add (array, _tmp12_);
	test_generic_array_owned (array);
	test_generic_array_unowned (array);
	_g_ptr_array_unref0 (array);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}

void
test_gsequence_owned (GSequence* sequence)
{
	guint i = 0U;
	g_return_if_fail (sequence != NULL);
	i = (guint) 0;
	{
		GSequence* item_collection = NULL;
		GSequenceIter* item_iter = NULL;
		item_collection = sequence;
		for (item_iter = g_sequence_get_begin_iter (item_collection); !g_sequence_iter_is_end (item_iter); item_iter = g_sequence_iter_next (item_iter)) {
			GValue* _tmp0_;
			GValue* item = NULL;
			_tmp0_ = __g_value_dup0 ((GValue*) g_sequence_get (item_iter));
			item = _tmp0_;
			{
				guint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
				__vala_GValue_free0 (item);
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_gsequence_unowned (GSequence* sequence)
{
	guint i = 0U;
	g_return_if_fail (sequence != NULL);
	i = (guint) 0;
	{
		GSequence* item_collection = NULL;
		GSequenceIter* item_iter = NULL;
		item_collection = sequence;
		for (item_iter = g_sequence_get_begin_iter (item_collection); !g_sequence_iter_is_end (item_iter); item_iter = g_sequence_iter_next (item_iter)) {
			GValue* item = NULL;
			item = (GValue*) g_sequence_get (item_iter);
			{
				guint _tmp0_;
				_tmp0_ = i;
				i = _tmp0_ + 1;
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_foreach_gsequence (void)
{
	GValue value = {0};
	GSequence* sequence = NULL;
	GSequence* _tmp0_;
	GValue _tmp1_ = {0};
	GValue _tmp2_;
	GValue _tmp3_;
	GValue* _tmp4_;
	GSequenceIter* _tmp5_;
	GValue _tmp6_ = {0};
	GValue _tmp7_;
	GValue _tmp8_;
	GValue* _tmp9_;
	GSequenceIter* _tmp10_;
	GValue _tmp11_ = {0};
	GValue _tmp12_;
	GValue _tmp13_;
	GValue* _tmp14_;
	GSequenceIter* _tmp15_;
	_tmp0_ = g_sequence_new (__vala_GValue_free0_);
	sequence = _tmp0_;
	g_value_init (&_tmp1_, G_TYPE_INT);
	g_value_set_int (&_tmp1_, 1);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp1_;
	_tmp2_ = value;
	_tmp3_ = _tmp2_;
	_tmp4_ = __g_value_dup0 (&_tmp3_);
	_tmp5_ = g_sequence_append (sequence, _tmp4_);
	g_value_init (&_tmp6_, G_TYPE_DOUBLE);
	g_value_set_double (&_tmp6_, 2.0);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp6_;
	_tmp7_ = value;
	_tmp8_ = _tmp7_;
	_tmp9_ = __g_value_dup0 (&_tmp8_);
	_tmp10_ = g_sequence_append (sequence, _tmp9_);
	g_value_init (&_tmp11_, G_TYPE_STRING);
	g_value_set_string (&_tmp11_, "three");
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp11_;
	_tmp12_ = value;
	_tmp13_ = _tmp12_;
	_tmp14_ = __g_value_dup0 (&_tmp13_);
	_tmp15_ = g_sequence_append (sequence, _tmp14_);
	test_gsequence_owned (sequence);
	test_gsequence_unowned (sequence);
	_g_sequence_free0 (sequence);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}

void
test_garray_owned (GArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
			GValue* _tmp0_;
			GValue* item = NULL;
			_tmp0_ = __g_value_dup0 (g_array_index (item_collection, GValue*, item_index));
			item = _tmp0_;
			{
				guint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
				__vala_GValue_free0 (item);
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

void
test_garray_unowned (GArray* array)
{
	guint i = 0U;
	g_return_if_fail (array != NULL);
	i = (guint) 0;
	{
		GArray* item_collection = NULL;
		guint item_index = 0U;
		item_collection = array;
		for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
			GValue* item = NULL;
			item = g_array_index (item_collection, GValue*, item_index);
			{
				guint _tmp0_;
				_tmp0_ = i;
				i = _tmp0_ + 1;
			}
		}
	}
	_vala_assert (i == ((guint) 3), "i == 3");
}

static void
_vala_GValue_free_function_content_of (gpointer data)
{
	GValue* self;
	self = *((GValue**) data);
	__vala_GValue_free0_ (self);
}

void
test_foreach_garray (void)
{
	GValue value = {0};
	GArray* array = NULL;
	GArray* _tmp0_;
	GValue _tmp1_ = {0};
	GValue _tmp2_;
	GValue _tmp3_;
	GValue* _tmp4_;
	GValue _tmp5_ = {0};
	GValue _tmp6_;
	GValue _tmp7_;
	GValue* _tmp8_;
	GValue _tmp9_ = {0};
	GValue _tmp10_;
	GValue _tmp11_;
	GValue* _tmp12_;
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (GValue*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_GValue_free_function_content_of);
	array = _tmp0_;
	g_value_init (&_tmp1_, G_TYPE_INT);
	g_value_set_int (&_tmp1_, 1);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp1_;
	_tmp2_ = value;
	_tmp3_ = _tmp2_;
	_tmp4_ = __g_value_dup0 (&_tmp3_);
	g_array_append_val (array, _tmp4_);
	g_value_init (&_tmp5_, G_TYPE_DOUBLE);
	g_value_set_double (&_tmp5_, 2.0);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp5_;
	_tmp6_ = value;
	_tmp7_ = _tmp6_;
	_tmp8_ = __g_value_dup0 (&_tmp7_);
	g_array_append_val (array, _tmp8_);
	g_value_init (&_tmp9_, G_TYPE_STRING);
	g_value_set_string (&_tmp9_, "three");
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp9_;
	_tmp10_ = value;
	_tmp11_ = _tmp10_;
	_tmp12_ = __g_value_dup0 (&_tmp11_);
	g_array_append_val (array, _tmp12_);
	test_garray_owned (array);
	test_garray_unowned (array);
	_g_array_unref0 (array);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}

void
test_foreach_multidim_array (void)
{
	gint* foo = NULL;
	gint* _tmp0_;
	gint foo_length1;
	gint foo_length2;
	gchar* _result_ = NULL;
	gchar* _tmp1_;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	const gchar* _tmp7_;
	_tmp0_ = g_new0 (gint, 3 * 2);
	_tmp0_[0] = 1;
	_tmp0_[1] = 2;
	_tmp0_[2] = 3;
	_tmp0_[3] = 4;
	_tmp0_[4] = 5;
	_tmp0_[5] = 6;
	foo = _tmp0_;
	foo_length1 = 3;
	foo_length2 = 2;
	_tmp1_ = g_strdup ("");
	_result_ = _tmp1_;
	_tmp2_ = foo;
	_tmp2__length1 = foo_length1;
	_tmp2__length2 = foo_length2;
	{
		gint* i_collection = NULL;
		gint i_collection_length1 = 0;
		gint i_collection_length2 = 0;
		gint i_it = 0;
		i_collection = _tmp2_;
		i_collection_length1 = _tmp2__length1 * _tmp2__length2;
		for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
			gint i = 0;
			i = i_collection[i_it];
			{
				const gchar* _tmp3_;
				gchar* _tmp4_;
				gchar* _tmp5_;
				gchar* _tmp6_;
				_tmp3_ = _result_;
				_tmp4_ = g_strdup_printf ("%i", i);
				_tmp5_ = _tmp4_;
				_tmp6_ = g_strconcat (_tmp3_, _tmp5_, NULL);
				_g_free0 (_result_);
				_result_ = _tmp6_;
				_g_free0 (_tmp5_);
			}
		}
	}
	_tmp7_ = _result_;
	_vala_assert (g_strcmp0 (_tmp7_, "123456") == 0, "result == \"123456\"");
	_g_free0 (_result_);
	foo = (g_free (foo), NULL);
}

void
test_foreach_const_array (void)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	const gchar* _tmp5_;
	gchar* result2 = NULL;
	gchar* _tmp6_;
	const gchar* _tmp11_;
	_tmp0_ = g_strdup ("");
	_result_ = _tmp0_;
	{
		gint* i_collection = NULL;
		gint i_collection_length1 = 0;
		gint _i_collection_size_ = 0;
		gint i_it = 0;
		i_collection = FOO;
		i_collection_length1 = G_N_ELEMENTS (FOO);
		for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
			gint i = 0;
			i = i_collection[i_it];
			{
				const gchar* _tmp1_;
				gchar* _tmp2_;
				gchar* _tmp3_;
				gchar* _tmp4_;
				_tmp1_ = _result_;
				_tmp2_ = g_strdup_printf ("%i", i);
				_tmp3_ = _tmp2_;
				_tmp4_ = g_strconcat (_tmp1_, _tmp3_, NULL);
				_g_free0 (_result_);
				_result_ = _tmp4_;
				_g_free0 (_tmp3_);
			}
		}
	}
	_tmp5_ = _result_;
	_vala_assert (g_strcmp0 (_tmp5_, "123456") == 0, "result == \"123456\"");
	_tmp6_ = g_strdup ("");
	result2 = _tmp6_;
	{
		gint* i_collection = NULL;
		gint i_collection_length1 = 0;
		gint _i_collection_size_ = 0;
		gint i_it = 0;
		i_collection = BAR;
		i_collection_length1 = G_N_ELEMENTS (BAR);
		for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
			gint i = 0;
			i = i_collection[i_it];
			{
				const gchar* _tmp7_;
				gchar* _tmp8_;
				gchar* _tmp9_;
				gchar* _tmp10_;
				_tmp7_ = result2;
				_tmp8_ = g_strdup_printf ("%i", i);
				_tmp9_ = _tmp8_;
				_tmp10_ = g_strconcat (_tmp7_, _tmp9_, NULL);
				_g_free0 (result2);
				result2 = _tmp10_;
				_g_free0 (_tmp9_);
			}
		}
	}
	_tmp11_ = result2;
	_vala_assert (g_strcmp0 (_tmp11_, "654321") == 0, "result2 == \"654321\"");
	_g_free0 (result2);
	_g_free0 (_result_);
}

void
test_foreach_slice_array (void)
{
	gint* foo = NULL;
	gint* _tmp0_;
	gint foo_length1;
	gint _foo_size_;
	gchar* _result_ = NULL;
	gchar* _tmp1_;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint* _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp8_;
	_tmp0_ = g_new0 (gint, 6);
	_tmp0_[0] = 1;
	_tmp0_[1] = 2;
	_tmp0_[2] = 3;
	_tmp0_[3] = 4;
	_tmp0_[4] = 5;
	_tmp0_[5] = 6;
	foo = _tmp0_;
	foo_length1 = 6;
	_foo_size_ = foo_length1;
	_tmp1_ = g_strdup ("");
	_result_ = _tmp1_;
	_tmp2_ = foo;
	_tmp2__length1 = foo_length1;
	_tmp3_ = foo;
	_tmp3__length1 = foo_length1;
	{
		gint* i_collection = NULL;
		gint i_collection_length1 = 0;
		gint _i_collection_size_ = 0;
		gint i_it = 0;
		i_collection = _tmp2_ + 1;
		i_collection_length1 = (_tmp3__length1 - 1) - 1;
		for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
			gint i = 0;
			i = i_collection[i_it];
			{
				const gchar* _tmp4_;
				gchar* _tmp5_;
				gchar* _tmp6_;
				gchar* _tmp7_;
				_tmp4_ = _result_;
				_tmp5_ = g_strdup_printf ("%i", i);
				_tmp6_ = _tmp5_;
				_tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
				_g_free0 (_result_);
				_result_ = _tmp7_;
				_g_free0 (_tmp6_);
			}
		}
	}
	_tmp8_ = _result_;
	_vala_assert (g_strcmp0 (_tmp8_, "2345") == 0, "result == \"2345\"");
	_g_free0 (_result_);
	foo = (g_free (foo), NULL);
}

static void
_vala_main (void)
{
	test_foreach_gvaluearray ();
	test_foreach_garray ();
	test_foreach_genericarray ();
	test_foreach_gsequence ();
	test_foreach_const_array ();
	test_foreach_multidim_array ();
	test_foreach_slice_array ();
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}