/* testset.c generated by valac 0.25.1.16-fa2259, the Vala compiler
 * generated from testset.vala, do not modify */

/* testset.vala
 *
 * Copyright (C) 2008  Jürg Billeter
 * Copyright (C) 2009  Didier Villevalois, Julien Peeters
 *
 * 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:
 * 	Jürg Billeter <j@bitron.ch>
 * 	Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
 * 	Julien Peeters <contact@julienpeeters.fr>
 */

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


#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_SET_TESTS (set_tests_get_type ())
#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests))
#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass))
#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS))
#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS))
#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass))

typedef struct _SetTests SetTests;
typedef struct _SetTestsClass SetTestsClass;
typedef struct _SetTestsPrivate SetTestsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (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 _SetTests {
	CollectionTests parent_instance;
	SetTestsPrivate * priv;
};

struct _SetTestsClass {
	CollectionTestsClass parent_class;
	void (*test_duplicates_are_ignored) (SetTests* self);
};

typedef void (*GeeTestCaseTestMethod) (void* user_data);

static gpointer set_tests_parent_class = NULL;

GType gee_test_case_get_type (void) G_GNUC_CONST;
GType collection_tests_get_type (void) G_GNUC_CONST;
GType set_tests_get_type (void) G_GNUC_CONST;
enum  {
	SET_TESTS_DUMMY_PROPERTY
};
SetTests* set_tests_construct (GType object_type, const gchar* name);
CollectionTests* collection_tests_construct (GType object_type, const gchar* name);
void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GDestroyNotify test_target_destroy_notify);
void set_tests_test_duplicates_are_ignored (SetTests* self);
static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self);
static void set_tests_real_test_duplicates_are_ignored (SetTests* self);


static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self) {
	set_tests_test_duplicates_are_ignored ((SetTests*) self);
}


SetTests* set_tests_construct (GType object_type, const gchar* name) {
	SetTests * self = NULL;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = name;
	self = (SetTests*) collection_tests_construct (object_type, _tmp0_);
	gee_test_case_add_test ((GeeTestCase*) self, "[Set] duplicates are ignored", _set_tests_test_duplicates_are_ignored_gee_test_case_test_method, g_object_ref (self), g_object_unref);
	return self;
}


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


static void set_tests_real_test_duplicates_are_ignored (SetTests* self) {
	GeeSet* test_set = NULL;
	GeeCollection* _tmp0_ = NULL;
	GeeSet* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gint _tmp8_ = 0;
	gint _tmp9_ = 0;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gint _tmp12_ = 0;
	gint _tmp13_ = 0;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	gint _tmp16_ = 0;
	gint _tmp17_ = 0;
	_tmp0_ = ((CollectionTests*) self)->test_collection;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SET) ? ((GeeSet*) _tmp0_) : NULL);
	test_set = _tmp1_;
	_vala_assert (test_set != NULL, "test_set != null");
	_tmp2_ = gee_collection_add ((GeeCollection*) test_set, "one");
	_vala_assert (_tmp2_, "test_set.add (\"one\")");
	_tmp3_ = gee_collection_contains ((GeeCollection*) test_set, "one");
	_vala_assert (_tmp3_, "test_set.contains (\"one\")");
	_tmp4_ = gee_collection_get_size ((GeeCollection*) test_set);
	_tmp5_ = _tmp4_;
	_vala_assert (_tmp5_ == 1, "test_set.size == 1");
	_tmp6_ = gee_collection_add ((GeeCollection*) test_set, "one");
	_vala_assert (!_tmp6_, "! test_set.add (\"one\")");
	_tmp7_ = gee_collection_contains ((GeeCollection*) test_set, "one");
	_vala_assert (_tmp7_, "test_set.contains (\"one\")");
	_tmp8_ = gee_collection_get_size ((GeeCollection*) test_set);
	_tmp9_ = _tmp8_;
	_vala_assert (_tmp9_ == 1, "test_set.size == 1");
	_tmp10_ = gee_collection_remove ((GeeCollection*) test_set, "one");
	_vala_assert (_tmp10_, "test_set.remove (\"one\")");
	_tmp11_ = gee_collection_contains ((GeeCollection*) test_set, "one");
	_vala_assert (!_tmp11_, "! test_set.contains (\"one\")");
	_tmp12_ = gee_collection_get_size ((GeeCollection*) test_set);
	_tmp13_ = _tmp12_;
	_vala_assert (_tmp13_ == 0, "test_set.size == 0");
	_tmp14_ = gee_collection_remove ((GeeCollection*) test_set, "one");
	_vala_assert (!_tmp14_, "! test_set.remove (\"one\")");
	_tmp15_ = gee_collection_contains ((GeeCollection*) test_set, "one");
	_vala_assert (!_tmp15_, "! test_set.contains (\"one\")");
	_tmp16_ = gee_collection_get_size ((GeeCollection*) test_set);
	_tmp17_ = _tmp16_;
	_vala_assert (_tmp17_ == 0, "test_set.size == 0");
	_g_object_unref0 (test_set);
}


void set_tests_test_duplicates_are_ignored (SetTests* self) {
	g_return_if_fail (self != NULL);
	SET_TESTS_GET_CLASS (self)->test_duplicates_are_ignored (self);
}


static void set_tests_class_init (SetTestsClass * klass) {
	set_tests_parent_class = g_type_class_peek_parent (klass);
	((SetTestsClass *) klass)->test_duplicates_are_ignored = set_tests_real_test_duplicates_are_ignored;
}


static void set_tests_instance_init (SetTests * self) {
}


GType set_tests_get_type (void) {
	static volatile gsize set_tests_type_id__volatile = 0;
	if (g_once_init_enter (&set_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SetTests), 0, (GInstanceInitFunc) set_tests_instance_init, NULL };
		GType set_tests_type_id;
		set_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "SetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&set_tests_type_id__volatile, set_tests_type_id);
	}
	return set_tests_type_id__volatile;
}



