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

/* testunrolledLinkedList.vala
 *
 * Copyright (C) 2008  Jürg Billeter
 *
 * 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
 *
 * Authors:
 * 	Jürg Billeter <j@bitron.ch>
 * 	Mark Lee <marklee@src.gnome.org> (port to UnrolledLinkedList)
 * 	Julien Peeters <contact@julienpeeters.fr>
 */

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

#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 GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))

typedef struct _GeeTestCase GeeTestCase;
typedef struct _GeeTestCaseClass GeeTestCaseClass;
typedef struct _GeeTestCasePrivate GeeTestCasePrivate;

#define TYPE_COLLECTION_TESTS (collection_tests_get_type ())
#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests))
#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass))
#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS))
#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS))
#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass))

typedef struct _CollectionTests CollectionTests;
typedef struct _CollectionTestsClass CollectionTestsClass;
typedef struct _CollectionTestsPrivate CollectionTestsPrivate;

#define TYPE_LIST_TESTS (list_tests_get_type ())
#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests))
#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass))
#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS))
#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS))
#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass))

typedef struct _ListTests ListTests;
typedef struct _ListTestsClass ListTestsClass;
typedef struct _ListTestsPrivate ListTestsPrivate;

#define TYPE_BIDIR_LIST_TESTS (bidir_list_tests_get_type ())
#define BIDIR_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BIDIR_LIST_TESTS, BidirListTests))
#define BIDIR_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BIDIR_LIST_TESTS, BidirListTestsClass))
#define IS_BIDIR_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BIDIR_LIST_TESTS))
#define IS_BIDIR_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BIDIR_LIST_TESTS))
#define BIDIR_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BIDIR_LIST_TESTS, BidirListTestsClass))

typedef struct _BidirListTests BidirListTests;
typedef struct _BidirListTestsClass BidirListTestsClass;
typedef struct _BidirListTestsPrivate BidirListTestsPrivate;

#define TYPE_UNROLLED_LINKED_LIST_TESTS (unrolled_linked_list_tests_get_type ())
#define UNROLLED_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNROLLED_LINKED_LIST_TESTS, UnrolledLinkedListTests))
#define UNROLLED_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNROLLED_LINKED_LIST_TESTS, UnrolledLinkedListTestsClass))
#define IS_UNROLLED_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNROLLED_LINKED_LIST_TESTS))
#define IS_UNROLLED_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNROLLED_LINKED_LIST_TESTS))
#define UNROLLED_LINKED_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNROLLED_LINKED_LIST_TESTS, UnrolledLinkedListTestsClass))

typedef struct _UnrolledLinkedListTests UnrolledLinkedListTests;
typedef struct _UnrolledLinkedListTestsClass UnrolledLinkedListTestsClass;
typedef struct _UnrolledLinkedListTestsPrivate UnrolledLinkedListTestsPrivate;
enum  {
	UNROLLED_LINKED_LIST_TESTS_0_PROPERTY,
	UNROLLED_LINKED_LIST_TESTS_NUM_PROPERTIES
};
static GParamSpec* unrolled_linked_list_tests_properties[UNROLLED_LINKED_LIST_TESTS_NUM_PROPERTIES];
typedef void (*GeeTestCaseTestMethod) (gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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);

struct _GeeTestCase {
	GObject parent_instance;
	GeeTestCasePrivate * priv;
};

struct _GeeTestCaseClass {
	GObjectClass parent_class;
	void (*set_up) (GeeTestCase* self);
	void (*tear_down) (GeeTestCase* self);
};

struct _CollectionTests {
	GeeTestCase parent_instance;
	CollectionTestsPrivate * priv;
	GeeCollection* test_collection;
};

struct _CollectionTestsClass {
	GeeTestCaseClass parent_class;
};

struct _ListTests {
	CollectionTests parent_instance;
	ListTestsPrivate * priv;
};

struct _ListTestsClass {
	CollectionTestsClass parent_class;
	void (*test_duplicates_are_retained) (ListTests* self);
};

struct _BidirListTests {
	ListTests parent_instance;
	BidirListTestsPrivate * priv;
};

struct _BidirListTestsClass {
	ListTestsClass parent_class;
};

struct _UnrolledLinkedListTests {
	BidirListTests parent_instance;
	UnrolledLinkedListTestsPrivate * priv;
};

struct _UnrolledLinkedListTestsClass {
	BidirListTestsClass parent_class;
};

static gpointer unrolled_linked_list_tests_parent_class = NULL;

VALA_EXTERN GType gee_test_case_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeTestCase, g_object_unref)
VALA_EXTERN GType collection_tests_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CollectionTests, g_object_unref)
VALA_EXTERN GType list_tests_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ListTests, g_object_unref)
VALA_EXTERN GType bidir_list_tests_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BidirListTests, g_object_unref)
VALA_EXTERN GType unrolled_linked_list_tests_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UnrolledLinkedListTests, g_object_unref)
VALA_EXTERN void gee_test_case_set_up (GeeTestCase* self);
VALA_EXTERN void gee_test_case_tear_down (GeeTestCase* self);
VALA_EXTERN UnrolledLinkedListTests* unrolled_linked_list_tests_new (void);
VALA_EXTERN UnrolledLinkedListTests* unrolled_linked_list_tests_construct (GType object_type);
VALA_EXTERN BidirListTests* bidir_list_tests_construct (GType object_type,
                                            const gchar* name);
VALA_EXTERN void gee_test_case_add_test (GeeTestCase* self,
                             const gchar* name,
                             GeeTestCaseTestMethod test,
                             gpointer test_target,
                             GDestroyNotify test_target_destroy_notify);
static void unrolled_linked_list_tests_test_sort (UnrolledLinkedListTests* self);
static void _unrolled_linked_list_tests_test_sort_gee_test_case_test_method (gpointer self);
static void unrolled_linked_list_tests_real_set_up (GeeTestCase* base);
static void unrolled_linked_list_tests_real_tear_down (GeeTestCase* base);
static GType unrolled_linked_list_tests_get_type_once (void);

static void
_unrolled_linked_list_tests_test_sort_gee_test_case_test_method (gpointer self)
{
	unrolled_linked_list_tests_test_sort ((UnrolledLinkedListTests*) self);
}

UnrolledLinkedListTests*
unrolled_linked_list_tests_construct (GType object_type)
{
	UnrolledLinkedListTests * self = NULL;
	self = (UnrolledLinkedListTests*) bidir_list_tests_construct (object_type, "UnrolledLinkedList");
	gee_test_case_add_test ((GeeTestCase*) self, "[UnrolledLinkedList] sort", _unrolled_linked_list_tests_test_sort_gee_test_case_test_method, g_object_ref (self), g_object_unref);
	return self;
}

UnrolledLinkedListTests*
unrolled_linked_list_tests_new (void)
{
	return unrolled_linked_list_tests_construct (TYPE_UNROLLED_LINKED_LIST_TESTS);
}

static void
unrolled_linked_list_tests_real_set_up (GeeTestCase* base)
{
	UnrolledLinkedListTests * self;
	GeeUnrolledLinkedList* _tmp0_;
	self = (UnrolledLinkedListTests*) base;
	_tmp0_ = gee_unrolled_linked_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_g_object_unref0 (((CollectionTests*) self)->test_collection);
	((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_;
}

static void
unrolled_linked_list_tests_real_tear_down (GeeTestCase* base)
{
	UnrolledLinkedListTests * self;
	self = (UnrolledLinkedListTests*) base;
	_g_object_unref0 (((CollectionTests*) self)->test_collection);
	((CollectionTests*) self)->test_collection = NULL;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
unrolled_linked_list_tests_test_sort (UnrolledLinkedListTests* self)
{
	GeeUnrolledLinkedList* test_list = NULL;
	GeeCollection* _tmp0_;
	GeeUnrolledLinkedList* _tmp1_;
	gpointer _tmp2_;
	gchar* _tmp3_;
	gpointer _tmp4_;
	gchar* _tmp5_;
	gpointer _tmp6_;
	gchar* _tmp7_;
	gpointer _tmp8_;
	gchar* _tmp9_;
	gpointer _tmp10_;
	gchar* _tmp11_;
	gpointer _tmp12_;
	gchar* _tmp13_;
	gpointer _tmp14_;
	gchar* _tmp15_;
	gpointer _tmp16_;
	gchar* _tmp17_;
	gpointer _tmp18_;
	gchar* _tmp19_;
	gpointer _tmp20_;
	gchar* _tmp21_;
	gpointer _tmp22_;
	gchar* _tmp23_;
	gpointer _tmp24_;
	gchar* _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ((CollectionTests*) self)->test_collection;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_UNROLLED_LINKED_LIST) ? ((GeeUnrolledLinkedList*) _tmp0_) : NULL);
	test_list = _tmp1_;
	_vala_assert (test_list != NULL, "test_list != null");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven");
	gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve");
	gee_list_sort ((GeeList*) test_list, NULL, NULL, NULL);
	_tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0);
	_tmp3_ = (gchar*) _tmp2_;
	_vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\"");
	_g_free0 (_tmp3_);
	_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1);
	_tmp5_ = (gchar*) _tmp4_;
	_vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\"");
	_g_free0 (_tmp5_);
	_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2);
	_tmp7_ = (gchar*) _tmp6_;
	_vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\"");
	_g_free0 (_tmp7_);
	_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3);
	_tmp9_ = (gchar*) _tmp8_;
	_vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\"");
	_g_free0 (_tmp9_);
	_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4);
	_tmp11_ = (gchar*) _tmp10_;
	_vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\"");
	_g_free0 (_tmp11_);
	_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5);
	_tmp13_ = (gchar*) _tmp12_;
	_vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\"");
	_g_free0 (_tmp13_);
	_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6);
	_tmp15_ = (gchar*) _tmp14_;
	_vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\"");
	_g_free0 (_tmp15_);
	_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7);
	_tmp17_ = (gchar*) _tmp16_;
	_vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\"");
	_g_free0 (_tmp17_);
	_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8);
	_tmp19_ = (gchar*) _tmp18_;
	_vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\"");
	_g_free0 (_tmp19_);
	_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9);
	_tmp21_ = (gchar*) _tmp20_;
	_vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\"");
	_g_free0 (_tmp21_);
	_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10);
	_tmp23_ = (gchar*) _tmp22_;
	_vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\"");
	_g_free0 (_tmp23_);
	_tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11);
	_tmp25_ = (gchar*) _tmp24_;
	_vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\"");
	_g_free0 (_tmp25_);
	_g_object_unref0 (test_list);
}

static void
unrolled_linked_list_tests_class_init (UnrolledLinkedListTestsClass * klass,
                                       gpointer klass_data)
{
	unrolled_linked_list_tests_parent_class = g_type_class_peek_parent (klass);
	((GeeTestCaseClass *) klass)->set_up = (void (*) (GeeTestCase*)) unrolled_linked_list_tests_real_set_up;
	((GeeTestCaseClass *) klass)->tear_down = (void (*) (GeeTestCase*)) unrolled_linked_list_tests_real_tear_down;
}

static void
unrolled_linked_list_tests_instance_init (UnrolledLinkedListTests * self,
                                          gpointer klass)
{
}

static GType
unrolled_linked_list_tests_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UnrolledLinkedListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unrolled_linked_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnrolledLinkedListTests), 0, (GInstanceInitFunc) unrolled_linked_list_tests_instance_init, NULL };
	GType unrolled_linked_list_tests_type_id;
	unrolled_linked_list_tests_type_id = g_type_register_static (TYPE_BIDIR_LIST_TESTS, "UnrolledLinkedListTests", &g_define_type_info, 0);
	return unrolled_linked_list_tests_type_id;
}

GType
unrolled_linked_list_tests_get_type (void)
{
	static volatile gsize unrolled_linked_list_tests_type_id__once = 0;
	if (g_once_init_enter (&unrolled_linked_list_tests_type_id__once)) {
		GType unrolled_linked_list_tests_type_id;
		unrolled_linked_list_tests_type_id = unrolled_linked_list_tests_get_type_once ();
		g_once_init_leave (&unrolled_linked_list_tests_type_id__once, unrolled_linked_list_tests_type_id);
	}
	return unrolled_linked_list_tests_type_id__once;
}

