/* testdata.c generated by valac 0.56.3, the Vala compiler
 * generated from testdata.vala, do not modify */

/* testcollection.vala
 *
 * Copyright (C) 2012  Maciej Piechotka
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 *      Maciej Piechotka <uzytkownik2@gmail.com>
 */

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>

#define TEST_DATA_RND_IDX_SIZE ((guint) 8)
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_TEST_DATA (test_data_get_type ())
#define TEST_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_DATA, TestData))
#define TEST_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_DATA, TestDataClass))
#define IS_TEST_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_DATA))
#define IS_TEST_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_DATA))
#define TEST_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_DATA, TestDataClass))

typedef struct _TestData TestData;
typedef struct _TestDataClass TestDataClass;
typedef struct _TestDataPrivate TestDataPrivate;
#define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block7Data Block7Data;
typedef struct _ParamSpecTestData ParamSpecTestData;

struct _TestData {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TestDataPrivate * priv;
};

struct _TestDataClass {
	GTypeClass parent_class;
	void (*finalize) (TestData *self);
};

struct _Block7Data {
	int _ref_count_;
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	GCompareDataFunc compare_func;
	gpointer compare_func_target;
};

struct _ParamSpecTestData {
	GParamSpec parent_instance;
};

static gpointer test_data_parent_class = NULL;
static gchar** test_data_ones;
static gint test_data_ones_length1;
static gchar** test_data_ones = NULL;
static gint test_data_ones_length1 = 0;
static gint _test_data_ones_size_ = 0;
static gchar** test_data_tens;
static gint test_data_tens_length1;
static gchar** test_data_tens = NULL;
static gint test_data_tens_length1 = 0;
static gint _test_data_tens_size_ = 0;
static gchar* test_data_hundred;
static gchar* test_data_hundred = NULL;
static gchar** test_data_thousands;
static gint test_data_thousands_length1;
static gchar** test_data_thousands = NULL;
static gint test_data_thousands_length1 = 0;
static gint _test_data_thousands_size_ = 0;
static guint test_data_DATA_SIZE;
static guint test_data_DATA_SIZE = 0U;
static gchar** test_data_data;
static gint test_data_data_length1;
static gchar** test_data_data = NULL;
static gint test_data_data_length1 = 0;
static gint _test_data_data_size_ = 0;
static gchar** test_data_sorted_data;
static gint test_data_sorted_data_length1;
static gchar** test_data_sorted_data = NULL;
static gint test_data_sorted_data_length1 = 0;
static gint _test_data_sorted_data_size_ = 0;
static guint* test_data_random_idx;
static gint test_data_random_idx_length1;
static guint* test_data_random_idx = NULL;
static gint test_data_random_idx_length1 = 0;
static gint _test_data_random_idx_size_ = 0;

VALA_EXTERN gpointer test_data_ref (gpointer instance);
VALA_EXTERN void test_data_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_test_data (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_test_data (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_test_data (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_test_data (const GValue* value);
VALA_EXTERN GType test_data_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestData, test_data_unref)
static guint test_data_data_size (void);
static gchar** test_data_create_data (guint count,
                               gint* result_length1);
static gchar** test_data_sort_array (gchar** array,
                              gint array_length1,
                              gint* result_length1);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static guint* test_data_draw_numbers (guint n,
                               guint k,
                               gint* result_length1);
VALA_EXTERN gchar** test_data_get_data (gint* result_length1);
VALA_EXTERN gchar** test_data_get_sorted_data (gint* result_length1);
VALA_EXTERN guint* test_data_get_drawn_numbers (gint* result_length1);
static gchar* test_data_print3digit (guint n);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static gint ___lambda3__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
static gint __lambda4_ (const gchar* a,
                 const gchar* b);
static gint ___lambda4__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
VALA_EXTERN TestData* test_data_new (void);
VALA_EXTERN TestData* test_data_construct (GType object_type);
static void test_data_finalize (TestData * obj);
static GType test_data_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static guint
test_data_data_size (void)
{
	gint _tmp0_ = 0;
	guint result;
	if (g_test_quick ()) {
		_tmp0_ = 128;
	} else {
		_tmp0_ = 1024;
	}
	result = (guint) _tmp0_;
	return result;
}

gchar**
test_data_get_data (gint* result_length1)
{
	GTypeClass* klass = NULL;
	GTypeClass* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	_tmp0_ = g_type_class_ref (TYPE_TEST_DATA);
	klass = _tmp0_;
	G_TYPE_FROM_CLASS (klass);
	_tmp1_ = test_data_data;
	_tmp1__length1 = test_data_data_length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	_g_type_class_unref0 (klass);
	return result;
}

gchar**
test_data_get_sorted_data (gint* result_length1)
{
	GTypeClass* klass = NULL;
	GTypeClass* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	_tmp0_ = g_type_class_ref (TYPE_TEST_DATA);
	klass = _tmp0_;
	G_TYPE_FROM_CLASS (klass);
	_tmp1_ = test_data_sorted_data;
	_tmp1__length1 = test_data_sorted_data_length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	_g_type_class_unref0 (klass);
	return result;
}

guint*
test_data_get_drawn_numbers (gint* result_length1)
{
	GTypeClass* klass = NULL;
	GTypeClass* _tmp0_;
	guint* _tmp1_;
	gint _tmp1__length1;
	guint* _tmp2_;
	gint _tmp2__length1;
	guint* result;
	_tmp0_ = g_type_class_ref (TYPE_TEST_DATA);
	klass = _tmp0_;
	G_TYPE_FROM_CLASS (klass);
	_tmp1_ = test_data_random_idx;
	_tmp1__length1 = test_data_random_idx_length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	_g_type_class_unref0 (klass);
	return result;
}

static guint*
test_data_draw_numbers (guint n,
                        guint k,
                        gint* result_length1)
{
	guint* _result_ = NULL;
	guint* _tmp0_;
	gint _result__length1;
	gint __result__size_;
	gint _tmp12_;
	guint* _tmp13_;
	gint _tmp13__length1;
	guint* _tmp14_;
	gint _tmp14__length1;
	guint* result;
	_tmp0_ = g_new0 (guint, n);
	_result_ = _tmp0_;
	_result__length1 = n;
	__result__size_ = _result__length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				guint* _tmp3_;
				gint _tmp3__length1;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp3_ = _result_;
				_tmp3__length1 = _result__length1;
				_tmp3_[i] = i;
			}
		}
	}
	{
		guint i = 0U;
		i = n - 1;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				gint j = 0;
				guint tmp = 0U;
				guint* _tmp6_;
				gint _tmp6__length1;
				guint _tmp7_;
				guint* _tmp8_;
				gint _tmp8__length1;
				guint* _tmp9_;
				gint _tmp9__length1;
				guint _tmp10_;
				guint* _tmp11_;
				gint _tmp11__length1;
				if (!_tmp4_) {
					guint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ - 1;
				}
				_tmp4_ = FALSE;
				if (!(i >= ((guint) 1))) {
					break;
				}
				j = (gint) g_test_rand_int_range ((gint32) 0, (gint32) (i + 1));
				_tmp6_ = _result_;
				_tmp6__length1 = _result__length1;
				_tmp7_ = _tmp6_[i];
				tmp = _tmp7_;
				_tmp8_ = _result_;
				_tmp8__length1 = _result__length1;
				_tmp9_ = _result_;
				_tmp9__length1 = _result__length1;
				_tmp10_ = _tmp9_[j];
				_tmp8_[i] = _tmp10_;
				_tmp11_ = _result_;
				_tmp11__length1 = _result__length1;
				_tmp11_[j] = tmp;
			}
		}
	}
	_tmp12_ = (gint) k;
	_result_ = g_renew (guint, _result_, (gint) k);
	(_tmp12_ > _result__length1) ? memset (_result_ + _result__length1, 0, sizeof (guint) * (_tmp12_ - _result__length1)) : NULL;
	_result__length1 = _tmp12_;
	__result__size_ = _tmp12_;
	_tmp13_ = _result_;
	_tmp13__length1 = _result__length1;
	_result_ = NULL;
	_result__length1 = 0;
	_tmp14_ = _tmp13_;
	_tmp14__length1 = _tmp13__length1;
	if (result_length1) {
		*result_length1 = _tmp14__length1;
	}
	result = _tmp14_;
	_result_ = (g_free (_result_), NULL);
	return result;
}

static gchar*
test_data_print3digit (guint n)
{
	gchar* _tmp0_ = NULL;
	gchar* h = NULL;
	gchar* _tmp8_;
	const gchar* t = NULL;
	gchar** _tmp9_;
	gint _tmp9__length1;
	const gchar* _tmp10_;
	guint _tmp11_ = 0U;
	gchar** _tmp12_;
	gint _tmp12__length1;
	const gchar* o = NULL;
	gchar** _tmp13_;
	gint _tmp13__length1;
	const gchar* _tmp14_;
	const gchar* _tmp15_ = NULL;
	const gchar* _tmp16_;
	const gchar* _tmp18_ = NULL;
	gboolean _tmp19_ = FALSE;
	const gchar* _tmp20_;
	const gchar* _tmp24_ = NULL;
	const gchar* _tmp25_;
	const gchar* _tmp27_ = NULL;
	gboolean _tmp28_ = FALSE;
	const gchar* _tmp29_;
	const gchar* _tmp31_ = NULL;
	const gchar* _tmp32_;
	gchar* _tmp34_;
	gchar* result;
	if (n >= ((guint) 200)) {
		gchar** _tmp1_;
		gint _tmp1__length1;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = test_data_ones;
		_tmp1__length1 = test_data_ones_length1;
		_tmp2_ = _tmp1_[n / 100];
		_tmp3_ = test_data_hundred;
		_tmp4_ = g_strdup_printf ("%s %s", _tmp2_, _tmp3_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	} else {
		const gchar* _tmp5_ = NULL;
		gchar* _tmp7_;
		if (n >= ((guint) 100)) {
			const gchar* _tmp6_;
			_tmp6_ = test_data_hundred;
			_tmp5_ = _tmp6_;
		} else {
			_tmp5_ = NULL;
		}
		_tmp7_ = g_strdup (_tmp5_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp7_;
	}
	_tmp8_ = g_strdup (_tmp0_);
	h = _tmp8_;
	n = n % 100;
	_tmp9_ = test_data_tens;
	_tmp9__length1 = test_data_tens_length1;
	_tmp10_ = _tmp9_[n / 10];
	t = _tmp10_;
	_tmp12_ = test_data_ones;
	_tmp12__length1 = test_data_ones_length1;
	if (n >= ((guint) _tmp12__length1)) {
		_tmp11_ = n % 10;
	} else {
		_tmp11_ = n;
	}
	n = _tmp11_;
	_tmp13_ = test_data_ones;
	_tmp13__length1 = test_data_ones_length1;
	_tmp14_ = _tmp13_[n];
	o = _tmp14_;
	_tmp16_ = h;
	if (_tmp16_ != NULL) {
		const gchar* _tmp17_;
		_tmp17_ = h;
		_tmp15_ = _tmp17_;
	} else {
		_tmp15_ = "";
	}
	_tmp20_ = h;
	if (_tmp20_ != NULL) {
		gboolean _tmp21_ = FALSE;
		const gchar* _tmp22_;
		_tmp22_ = t;
		if (_tmp22_ != NULL) {
			_tmp21_ = TRUE;
		} else {
			const gchar* _tmp23_;
			_tmp23_ = o;
			_tmp21_ = _tmp23_ != NULL;
		}
		_tmp19_ = _tmp21_;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		_tmp18_ = " ";
	} else {
		_tmp18_ = "";
	}
	_tmp25_ = t;
	if (_tmp25_ != NULL) {
		const gchar* _tmp26_;
		_tmp26_ = t;
		_tmp24_ = _tmp26_;
	} else {
		_tmp24_ = "";
	}
	_tmp29_ = t;
	if (_tmp29_ != NULL) {
		const gchar* _tmp30_;
		_tmp30_ = o;
		_tmp28_ = _tmp30_ != NULL;
	} else {
		_tmp28_ = FALSE;
	}
	if (_tmp28_) {
		_tmp27_ = "-";
	} else {
		_tmp27_ = "";
	}
	_tmp32_ = o;
	if (_tmp32_ != NULL) {
		const gchar* _tmp33_;
		_tmp33_ = o;
		_tmp31_ = _tmp33_;
	} else {
		_tmp31_ = "";
	}
	_tmp34_ = g_strdup_printf ("%s%s%s%s%s", _tmp15_, _tmp18_, _tmp24_, _tmp27_, _tmp31_);
	result = _tmp34_;
	_g_free0 (h);
	_g_free0 (_tmp0_);
	return result;
}

static gchar**
test_data_create_data (guint count,
                       gint* result_length1)
{
	gchar** numbers = NULL;
	gchar** _tmp0_;
	gint numbers_length1;
	gint _numbers_size_;
	gchar** _tmp24_;
	gint _tmp24__length1;
	gchar** _tmp25_;
	gint _tmp25__length1;
	gchar** result;
	_tmp0_ = g_new0 (gchar*, count + 1);
	numbers = _tmp0_;
	numbers_length1 = count;
	_numbers_size_ = numbers_length1;
	{
		guint idx = 0U;
		idx = (guint) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				guint n = 0U;
				gchar* num = NULL;
				guint th = 0U;
				const gchar* _tmp20_;
				gchar** _tmp22_;
				gint _tmp22__length1;
				gchar* _tmp23_;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = idx;
					idx = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(idx < count)) {
					break;
				}
				n = idx + 1;
				num = NULL;
				th = (guint) 0;
				while (TRUE) {
					guint _tmp19_;
					if (!(n != ((guint) 0))) {
						break;
					}
					if ((n % 1000) != ((guint) 0)) {
						gchar* t = NULL;
						gchar** _tmp3_;
						gint _tmp3__length1;
						const gchar* _tmp4_;
						gchar* _tmp5_;
						gchar* c = NULL;
						gchar* _tmp6_;
						const gchar* _tmp7_ = NULL;
						const gchar* _tmp8_;
						const gchar* _tmp9_ = NULL;
						const gchar* _tmp10_;
						const gchar* _tmp12_ = NULL;
						const gchar* _tmp13_;
						const gchar* _tmp14_ = NULL;
						const gchar* _tmp15_;
						const gchar* _tmp17_;
						gchar* _tmp18_;
						_tmp3_ = test_data_thousands;
						_tmp3__length1 = test_data_thousands_length1;
						_tmp4_ = _tmp3_[th];
						_tmp5_ = g_strdup (_tmp4_);
						t = _tmp5_;
						_tmp6_ = test_data_print3digit (n % 1000);
						c = _tmp6_;
						_tmp8_ = t;
						if (_tmp8_ != NULL) {
							_tmp7_ = " ";
						} else {
							_tmp7_ = "";
						}
						_tmp10_ = t;
						if (_tmp10_ != NULL) {
							const gchar* _tmp11_;
							_tmp11_ = t;
							_tmp9_ = _tmp11_;
						} else {
							_tmp9_ = "";
						}
						_tmp13_ = num;
						if (_tmp13_ != NULL) {
							_tmp12_ = " ";
						} else {
							_tmp12_ = "";
						}
						_tmp15_ = num;
						if (_tmp15_ != NULL) {
							const gchar* _tmp16_;
							_tmp16_ = num;
							_tmp14_ = _tmp16_;
						} else {
							_tmp14_ = "";
						}
						_tmp17_ = c;
						_tmp18_ = g_strdup_printf ("%s%s%s%s%s", _tmp17_, _tmp7_, _tmp9_, _tmp12_, _tmp14_);
						_g_free0 (num);
						num = _tmp18_;
						_g_free0 (c);
						_g_free0 (t);
					}
					n /= (guint) 1000;
					_tmp19_ = th;
					th = _tmp19_ + 1;
				}
				_tmp20_ = num;
				if (_tmp20_ == NULL) {
					gchar* _tmp21_;
					_tmp21_ = g_strdup ("zero");
					_g_free0 (num);
					num = _tmp21_;
				}
				_tmp22_ = numbers;
				_tmp22__length1 = numbers_length1;
				_tmp23_ = num;
				num = NULL;
				_g_free0 (_tmp22_[idx]);
				_tmp22_[idx] = _tmp23_;
				_g_free0 (num);
			}
		}
	}
	_tmp24_ = numbers;
	_tmp24__length1 = numbers_length1;
	numbers = NULL;
	numbers_length1 = 0;
	_tmp25_ = _tmp24_;
	_tmp25__length1 = _tmp24__length1;
	if (result_length1) {
		*result_length1 = _tmp25__length1;
	}
	result = _tmp25_;
	numbers = (_vala_array_free (numbers, numbers_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		GType t_type;
		GBoxedCopyFunc t_dup_func;
		GDestroyNotify t_destroy_func;
		t_type = _data7_->t_type;
		t_dup_func = _data7_->t_dup_func;
		t_destroy_func = _data7_->t_destroy_func;
		g_slice_free (Block7Data, _data7_);
	}
}

static gint
__lambda3_ (Block7Data* _data7_,
            gconstpointer* a,
            gconstpointer* b)
{
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	gint result;
	t_type = _data7_->t_type;
	t_dup_func = _data7_->t_dup_func;
	t_destroy_func = _data7_->t_destroy_func;
	result = _data7_->compare_func (*a, *b, _data7_->compare_func_target);
	return result;
}

static gint
___lambda3__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda3_ (self, a, b);
	return result;
}

static void
_vala_g_qsort_with_data (GType t_type,
                         GBoxedCopyFunc t_dup_func,
                         GDestroyNotify t_destroy_func,
                         gpointer* elems,
                         gint elems_length1,
                         gsize size,
                         GCompareDataFunc compare_func,
                         gpointer compare_func_target)
{
	Block7Data* _data7_;
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->t_type = t_type;
	_data7_->t_dup_func = t_dup_func;
	_data7_->t_destroy_func = t_destroy_func;
	_data7_->compare_func = (GCompareDataFunc) compare_func;
	_data7_->compare_func_target = compare_func_target;
	g_qsort_with_data (elems, (gint) elems_length1, size, (GCompareDataFunc) ___lambda3__gcompare_data_func, _data7_);
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

static gint
__lambda4_ (const gchar* a,
            const gchar* b)
{
	GCompareFunc _tmp0_;
	gint result;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	result = _tmp0_ (a, b);
	return result;
}

static gint
___lambda4__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda4_ ((const gchar*) a, (const gchar*) b);
	return result;
}

static gchar**
test_data_sort_array (gchar** array,
                      gint array_length1,
                      gint* result_length1)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** result;
	_vala_g_qsort_with_data (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, array, (gint) array_length1, (gsize) sizeof (gchar*), (GCompareDataFunc) ___lambda4__gcompare_data_func, NULL);
	_tmp0_ = array;
	_tmp0__length1 = array_length1;
	array = NULL;
	array_length1 = 0;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

TestData*
test_data_construct (GType object_type)
{
	TestData* self = NULL;
	self = (TestData*) g_type_create_instance (object_type);
	return self;
}

TestData*
test_data_new (void)
{
	return test_data_construct (TYPE_TEST_DATA);
}

static void
value_test_data_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_test_data_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		test_data_unref (value->data[0].v_pointer);
	}
}

static void
value_test_data_copy_value (const GValue* src_value,
                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = test_data_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_test_data_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_test_data_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		TestData * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = test_data_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_test_data_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	TestData ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = test_data_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_test_data (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	ParamSpecTestData* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_DATA), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_test_data (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DATA), NULL);
	return value->data[0].v_pointer;
}

void
value_set_test_data (GValue* value,
                     gpointer v_object)
{
	TestData * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		test_data_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		test_data_unref (old);
	}
}

void
value_take_test_data (GValue* value,
                      gpointer v_object)
{
	TestData * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		test_data_unref (old);
	}
}

static void
test_data_class_init (TestDataClass * klass,
                      gpointer klass_data)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar** _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar** _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar** _tmp34_;
	gint _tmp35_ = 0;
	gchar** _tmp36_;
	gchar** _tmp37_;
	gint _tmp37__length1;
	gchar** _tmp38_;
	gint _tmp38__length1;
	gint _tmp39_ = 0;
	gchar** _tmp40_;
	gint _tmp41_ = 0;
	guint* _tmp42_;
	test_data_parent_class = g_type_class_peek_parent (klass);
	((TestDataClass *) klass)->finalize = test_data_finalize;
	_tmp0_ = g_strdup ("one");
	_tmp1_ = g_strdup ("two");
	_tmp2_ = g_strdup ("three");
	_tmp3_ = g_strdup ("four");
	_tmp4_ = g_strdup ("five");
	_tmp5_ = g_strdup ("six");
	_tmp6_ = g_strdup ("seven");
	_tmp7_ = g_strdup ("eight");
	_tmp8_ = g_strdup ("nine");
	_tmp9_ = g_strdup ("ten");
	_tmp10_ = g_strdup ("eleven");
	_tmp11_ = g_strdup ("twelve");
	_tmp12_ = g_strdup ("thirteen");
	_tmp13_ = g_strdup ("fourteen");
	_tmp14_ = g_strdup ("fifteen");
	_tmp15_ = g_strdup ("sixteen");
	_tmp16_ = g_strdup ("seventeen");
	_tmp17_ = g_strdup ("eighteen");
	_tmp18_ = g_strdup ("nineteen");
	_tmp19_ = g_new0 (gchar*, 20 + 1);
	_tmp19_[0] = NULL;
	_tmp19_[1] = _tmp0_;
	_tmp19_[2] = _tmp1_;
	_tmp19_[3] = _tmp2_;
	_tmp19_[4] = _tmp3_;
	_tmp19_[5] = _tmp4_;
	_tmp19_[6] = _tmp5_;
	_tmp19_[7] = _tmp6_;
	_tmp19_[8] = _tmp7_;
	_tmp19_[9] = _tmp8_;
	_tmp19_[10] = _tmp9_;
	_tmp19_[11] = _tmp10_;
	_tmp19_[12] = _tmp11_;
	_tmp19_[13] = _tmp12_;
	_tmp19_[14] = _tmp13_;
	_tmp19_[15] = _tmp14_;
	_tmp19_[16] = _tmp15_;
	_tmp19_[17] = _tmp16_;
	_tmp19_[18] = _tmp17_;
	_tmp19_[19] = _tmp18_;
	test_data_ones = _tmp19_;
	test_data_ones_length1 = 20;
	_tmp20_ = g_strdup ("twenty");
	_tmp21_ = g_strdup ("thirty");
	_tmp22_ = g_strdup ("forty");
	_tmp23_ = g_strdup ("fifty");
	_tmp24_ = g_strdup ("sixty");
	_tmp25_ = g_strdup ("seventy");
	_tmp26_ = g_strdup ("eighty");
	_tmp27_ = g_strdup ("ninety");
	_tmp28_ = g_new0 (gchar*, 10 + 1);
	_tmp28_[0] = NULL;
	_tmp28_[1] = NULL;
	_tmp28_[2] = _tmp20_;
	_tmp28_[3] = _tmp21_;
	_tmp28_[4] = _tmp22_;
	_tmp28_[5] = _tmp23_;
	_tmp28_[6] = _tmp24_;
	_tmp28_[7] = _tmp25_;
	_tmp28_[8] = _tmp26_;
	_tmp28_[9] = _tmp27_;
	test_data_tens = _tmp28_;
	test_data_tens_length1 = 10;
	_tmp29_ = g_strdup ("hundred");
	test_data_hundred = _tmp29_;
	_tmp30_ = g_strdup ("thousand");
	_tmp31_ = g_strdup ("million");
	_tmp32_ = g_strdup ("billion");
	_tmp33_ = g_strdup ("trillion");
	_tmp34_ = g_new0 (gchar*, 5 + 1);
	_tmp34_[0] = NULL;
	_tmp34_[1] = _tmp30_;
	_tmp34_[2] = _tmp31_;
	_tmp34_[3] = _tmp32_;
	_tmp34_[4] = _tmp33_;
	test_data_thousands = _tmp34_;
	test_data_thousands_length1 = 5;
	test_data_DATA_SIZE = test_data_data_size ();
	_tmp36_ = test_data_create_data (test_data_DATA_SIZE, &_tmp35_);
	test_data_data = _tmp36_;
	test_data_data_length1 = _tmp35_;
	_tmp37_ = test_data_data;
	_tmp37__length1 = test_data_data_length1;
	_tmp38_ = (_tmp37_ != NULL) ? _vala_array_dup1 (_tmp37_, _tmp37__length1) : _tmp37_;
	_tmp38__length1 = _tmp37__length1;
	_tmp40_ = test_data_sort_array (_tmp38_, (gint) _tmp38__length1, &_tmp39_);
	test_data_sorted_data = _tmp40_;
	test_data_sorted_data_length1 = _tmp39_;
	_tmp42_ = test_data_draw_numbers (test_data_DATA_SIZE, TEST_DATA_RND_IDX_SIZE, &_tmp41_);
	test_data_random_idx = _tmp42_;
	test_data_random_idx_length1 = _tmp41_;
}

static void
test_data_instance_init (TestData * self,
                         gpointer klass)
{
	self->ref_count = 1;
}

static void
test_data_finalize (TestData * obj)
{
	TestData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_DATA, TestData);
	g_signal_handlers_destroy (self);
}

static GType
test_data_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_test_data_init, value_test_data_free_value, value_test_data_copy_value, value_test_data_peek_pointer, "p", value_test_data_collect_value, "p", value_test_data_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (TestDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestData), 0, (GInstanceInitFunc) test_data_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType test_data_type_id;
	test_data_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestData", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return test_data_type_id;
}

GType
test_data_get_type (void)
{
	static volatile gsize test_data_type_id__once = 0;
	if (g_once_init_enter (&test_data_type_id__once)) {
		GType test_data_type_id;
		test_data_type_id = test_data_get_type_once ();
		g_once_init_leave (&test_data_type_id__once, test_data_type_id);
	}
	return test_data_type_id__once;
}

gpointer
test_data_ref (gpointer instance)
{
	TestData * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
test_data_unref (gpointer instance)
{
	TestData * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		TEST_DATA_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

