/* rule.c generated by valac 0.26.0.83-ed603, the Vala compiler
 * generated from rule.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <libkkc-test.h>
#include <libkkc/libkkc-internals.h>
#include <stdlib.h>
#include <string.h>


#define TYPE_RULE_TESTS (rule_tests_get_type ())
#define RULE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RULE_TESTS, RuleTests))
#define RULE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RULE_TESTS, RuleTestsClass))
#define IS_RULE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RULE_TESTS))
#define IS_RULE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RULE_TESTS))
#define RULE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RULE_TESTS, RuleTestsClass))

typedef struct _RuleTests RuleTests;
typedef struct _RuleTestsClass RuleTestsClass;
typedef struct _RuleTestsPrivate RuleTestsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (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 _RuleTests {
	KkcTestCase parent_instance;
	RuleTestsPrivate * priv;
};

struct _RuleTestsClass {
	KkcTestCaseClass parent_class;
};


static gpointer rule_tests_parent_class = NULL;

GType rule_tests_get_type (void) G_GNUC_CONST;
enum  {
	RULE_TESTS_DUMMY_PROPERTY
};
RuleTests* rule_tests_new (void);
RuleTests* rule_tests_construct (GType object_type);
static void rule_tests_test_properties (RuleTests* self);
static void _rule_tests_test_properties_kkc_test_case_test_method (gpointer self);
static void rule_tests_test_load (RuleTests* self);
static void _rule_tests_test_load_kkc_test_case_test_method (gpointer self);
gint _vala_main (gchar** args, int args_length1);


static void _rule_tests_test_properties_kkc_test_case_test_method (gpointer self) {
#line 5 "/home/ueno/devel/libkkc/tests/rule.vala"
	rule_tests_test_properties ((RuleTests*) self);
#line 60 "rule.c"
}


static void _rule_tests_test_load_kkc_test_case_test_method (gpointer self) {
#line 6 "/home/ueno/devel/libkkc/tests/rule.vala"
	rule_tests_test_load ((RuleTests*) self);
#line 67 "rule.c"
}


RuleTests* rule_tests_construct (GType object_type) {
	RuleTests * self = NULL;
#line 3 "/home/ueno/devel/libkkc/tests/rule.vala"
	self = (RuleTests*) kkc_test_case_construct (object_type, "Rule");
#line 5 "/home/ueno/devel/libkkc/tests/rule.vala"
	kkc_test_case_add_test ((KkcTestCase*) self, "properties", _rule_tests_test_properties_kkc_test_case_test_method, self);
#line 6 "/home/ueno/devel/libkkc/tests/rule.vala"
	kkc_test_case_add_test ((KkcTestCase*) self, "load", _rule_tests_test_load_kkc_test_case_test_method, self);
#line 2 "/home/ueno/devel/libkkc/tests/rule.vala"
	return self;
#line 81 "rule.c"
}


RuleTests* rule_tests_new (void) {
#line 2 "/home/ueno/devel/libkkc/tests/rule.vala"
	return rule_tests_construct (TYPE_RULE_TESTS);
#line 88 "rule.c"
}


static void rule_tests_test_properties (RuleTests* self) {
	KkcRule* rule = NULL;
	KkcRuleMetadata* _tmp0_ = NULL;
	KkcRuleMetadata* _tmp1_ = NULL;
	KkcRule* _tmp2_ = NULL;
	KkcRule* _tmp3_ = NULL;
	KkcRuleMetadata* metadata = NULL;
	GError * _inner_error_ = NULL;
#line 9 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_return_if_fail (self != NULL);
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp0_ = kkc_rule_metadata_find ("default");
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp1_ = _tmp0_;
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp2_ = kkc_rule_new (_tmp1_, &_inner_error_);
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp3_ = _tmp2_;
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	_g_object_unref0 (_tmp1_);
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	rule = _tmp3_;
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
		g_clear_error (&_inner_error_);
#line 10 "/home/ueno/devel/libkkc/tests/rule.vala"
		return;
#line 122 "rule.c"
	}
#line 12 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_object_get ((GObject*) rule, "metadata", &metadata, NULL);
#line 9 "/home/ueno/devel/libkkc/tests/rule.vala"
	_g_object_unref0 (metadata);
#line 9 "/home/ueno/devel/libkkc/tests/rule.vala"
	_g_object_unref0 (rule);
#line 130 "rule.c"
}


static void rule_tests_test_load (RuleTests* self) {
#line 16 "/home/ueno/devel/libkkc/tests/rule.vala"
	static const gchar* good[] = {"test-empty"};
#line 20 "/home/ueno/devel/libkkc/tests/rule.vala"
	static const gchar* bad[] = {"test-bad1", "test-bad2", "test-bad3", "test-bad4", "test-bad5", "test-bad6", "test-bad7", "test-bad8", "test-bad9", "test-bad10"};
#line 139 "rule.c"
	gchar* srcdir = NULL;
	const gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	GError * _inner_error_ = NULL;
#line 15 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_return_if_fail (self != NULL);
#line 146 "rule.c"
	{
		const gchar** name_collection = NULL;
		gint name_collection_length1 = 0;
		gint _name_collection_size_ = 0;
		gint name_it = 0;
#line 33 "/home/ueno/devel/libkkc/tests/rule.vala"
		name_collection = good;
#line 33 "/home/ueno/devel/libkkc/tests/rule.vala"
		name_collection_length1 = G_N_ELEMENTS (good);
#line 33 "/home/ueno/devel/libkkc/tests/rule.vala"
		for (name_it = 0; name_it < G_N_ELEMENTS (good); name_it = name_it + 1) {
#line 158 "rule.c"
			const gchar* name = NULL;
#line 33 "/home/ueno/devel/libkkc/tests/rule.vala"
			name = name_collection[name_it];
#line 162 "rule.c"
			{
				KkcRuleMetadata* metadata = NULL;
				const gchar* _tmp0_ = NULL;
				KkcRuleMetadata* _tmp1_ = NULL;
#line 34 "/home/ueno/devel/libkkc/tests/rule.vala"
				_tmp0_ = name;
#line 34 "/home/ueno/devel/libkkc/tests/rule.vala"
				_tmp1_ = kkc_rule_metadata_find (_tmp0_);
#line 34 "/home/ueno/devel/libkkc/tests/rule.vala"
				metadata = _tmp1_;
#line 173 "rule.c"
				{
					KkcRule* rule = NULL;
					KkcRuleMetadata* _tmp2_ = NULL;
					KkcRule* _tmp3_ = NULL;
#line 36 "/home/ueno/devel/libkkc/tests/rule.vala"
					_tmp2_ = metadata;
#line 36 "/home/ueno/devel/libkkc/tests/rule.vala"
					_tmp3_ = kkc_rule_new (_tmp2_, &_inner_error_);
#line 36 "/home/ueno/devel/libkkc/tests/rule.vala"
					rule = _tmp3_;
#line 36 "/home/ueno/devel/libkkc/tests/rule.vala"
					if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 186 "rule.c"
						goto __catch0_g_error;
					}
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_object_unref0 (rule);
#line 191 "rule.c"
				}
				goto __finally0;
				__catch0_g_error:
				{
					GError* e = NULL;
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					e = _inner_error_;
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					_inner_error_ = NULL;
#line 38 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_assert_not_reached ();
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_error_free0 (e);
#line 205 "rule.c"
				}
				__finally0:
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_object_unref0 (metadata);
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_clear_error (&_inner_error_);
#line 35 "/home/ueno/devel/libkkc/tests/rule.vala"
					return;
#line 218 "rule.c"
				}
#line 33 "/home/ueno/devel/libkkc/tests/rule.vala"
				_g_object_unref0 (metadata);
#line 222 "rule.c"
			}
		}
	}
	{
		const gchar** name_collection = NULL;
		gint name_collection_length1 = 0;
		gint _name_collection_size_ = 0;
		gint name_it = 0;
#line 42 "/home/ueno/devel/libkkc/tests/rule.vala"
		name_collection = bad;
#line 42 "/home/ueno/devel/libkkc/tests/rule.vala"
		name_collection_length1 = G_N_ELEMENTS (bad);
#line 42 "/home/ueno/devel/libkkc/tests/rule.vala"
		for (name_it = 0; name_it < G_N_ELEMENTS (bad); name_it = name_it + 1) {
#line 237 "rule.c"
			const gchar* name = NULL;
#line 42 "/home/ueno/devel/libkkc/tests/rule.vala"
			name = name_collection[name_it];
#line 241 "rule.c"
			{
				KkcRuleMetadata* metadata = NULL;
				const gchar* _tmp4_ = NULL;
				KkcRuleMetadata* _tmp5_ = NULL;
#line 43 "/home/ueno/devel/libkkc/tests/rule.vala"
				_tmp4_ = name;
#line 43 "/home/ueno/devel/libkkc/tests/rule.vala"
				_tmp5_ = kkc_rule_metadata_find (_tmp4_);
#line 43 "/home/ueno/devel/libkkc/tests/rule.vala"
				metadata = _tmp5_;
#line 252 "rule.c"
				{
					KkcRule* rule = NULL;
					KkcRuleMetadata* _tmp6_ = NULL;
					KkcRule* _tmp7_ = NULL;
#line 45 "/home/ueno/devel/libkkc/tests/rule.vala"
					_tmp6_ = metadata;
#line 45 "/home/ueno/devel/libkkc/tests/rule.vala"
					_tmp7_ = kkc_rule_new (_tmp6_, &_inner_error_);
#line 45 "/home/ueno/devel/libkkc/tests/rule.vala"
					rule = _tmp7_;
#line 45 "/home/ueno/devel/libkkc/tests/rule.vala"
					if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 265 "rule.c"
						goto __catch1_g_error;
					}
#line 46 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_assert_not_reached ();
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_object_unref0 (rule);
#line 272 "rule.c"
				}
				goto __finally1;
				__catch1_g_error:
				{
					GError* e = NULL;
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					e = _inner_error_;
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					_inner_error_ = NULL;
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_error_free0 (e);
#line 284 "rule.c"
				}
				__finally1:
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					_g_object_unref0 (metadata);
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					g_clear_error (&_inner_error_);
#line 44 "/home/ueno/devel/libkkc/tests/rule.vala"
					return;
#line 297 "rule.c"
				}
#line 42 "/home/ueno/devel/libkkc/tests/rule.vala"
				_g_object_unref0 (metadata);
#line 301 "rule.c"
			}
		}
	}
#line 51 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp8_ = g_getenv ("srcdir");
#line 51 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp9_ = g_strdup (_tmp8_);
#line 51 "/home/ueno/devel/libkkc/tests/rule.vala"
	srcdir = _tmp9_;
#line 52 "/home/ueno/devel/libkkc/tests/rule.vala"
	_vala_assert (srcdir != NULL, "srcdir != null");
#line 313 "rule.c"
	{
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		KkcRuleMetadata* _tmp12_ = NULL;
		KkcRuleMetadata* _tmp13_ = NULL;
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_tmp10_ = g_build_filename (srcdir, "rule-metadata-bad.json", NULL);
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_tmp11_ = _tmp10_;
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_tmp12_ = kkc_rule_metadata_new ("bad", _tmp11_, &_inner_error_);
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_tmp13_ = _tmp12_;
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_g_object_unref0 (_tmp13_);
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		_g_free0 (_tmp11_);
#line 55 "/home/ueno/devel/libkkc/tests/rule.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 333 "rule.c"
			goto __catch2_g_error;
		}
#line 59 "/home/ueno/devel/libkkc/tests/rule.vala"
		g_assert_not_reached ();
#line 338 "rule.c"
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		e = _inner_error_;
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		_inner_error_ = NULL;
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		_g_error_free0 (e);
#line 350 "rule.c"
	}
	__finally2:
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		_g_free0 (srcdir);
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		g_clear_error (&_inner_error_);
#line 54 "/home/ueno/devel/libkkc/tests/rule.vala"
		return;
#line 363 "rule.c"
	}
#line 15 "/home/ueno/devel/libkkc/tests/rule.vala"
	_g_free0 (srcdir);
#line 367 "rule.c"
}


static void rule_tests_class_init (RuleTestsClass * klass) {
#line 1 "/home/ueno/devel/libkkc/tests/rule.vala"
	rule_tests_parent_class = g_type_class_peek_parent (klass);
#line 374 "rule.c"
}


static void rule_tests_instance_init (RuleTests * self) {
}


GType rule_tests_get_type (void) {
	static volatile gsize rule_tests_type_id__volatile = 0;
	if (g_once_init_enter (&rule_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RuleTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rule_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RuleTests), 0, (GInstanceInitFunc) rule_tests_instance_init, NULL };
		GType rule_tests_type_id;
		rule_tests_type_id = g_type_register_static (KKC_TYPE_TEST_CASE, "RuleTests", &g_define_type_info, 0);
		g_once_init_leave (&rule_tests_type_id__volatile, rule_tests_type_id);
	}
	return rule_tests_type_id__volatile;
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	GTestSuite* root = NULL;
	GTestSuite* _tmp0_ = NULL;
	RuleTests* _tmp1_ = NULL;
	RuleTests* _tmp2_ = NULL;
	GTestSuite* _tmp3_ = NULL;
#line 66 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_test_init (&args_length1, &args, NULL);
#line 67 "/home/ueno/devel/libkkc/tests/rule.vala"
	kkc_init ();
#line 69 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp0_ = g_test_get_root ();
#line 69 "/home/ueno/devel/libkkc/tests/rule.vala"
	root = _tmp0_;
#line 70 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp1_ = rule_tests_new ();
#line 70 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp2_ = _tmp1_;
#line 70 "/home/ueno/devel/libkkc/tests/rule.vala"
	_tmp3_ = kkc_test_case_get_suite ((KkcTestCase*) _tmp2_);
#line 70 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_test_suite_add_suite (root, _tmp3_);
#line 70 "/home/ueno/devel/libkkc/tests/rule.vala"
	_g_object_unref0 (_tmp2_);
#line 72 "/home/ueno/devel/libkkc/tests/rule.vala"
	g_test_run ();
#line 74 "/home/ueno/devel/libkkc/tests/rule.vala"
	result = 0;
#line 74 "/home/ueno/devel/libkkc/tests/rule.vala"
	return result;
#line 425 "rule.c"
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
#line 65 "/home/ueno/devel/libkkc/tests/rule.vala"
	return _vala_main (argv, argc);
#line 435 "rule.c"
}



