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

/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* TCDATATest.vala
 *
 * Copyright (C) 2011-2015  Daniel Espinosa <esodan@gmail.com>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

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

#define TYPE_GXML_TEST (gxml_test_get_type ())
#define GXML_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GXML_TEST, GXmlTest))
#define GXML_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GXML_TEST, GXmlTestClass))
#define IS_GXML_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GXML_TEST))
#define IS_GXML_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GXML_TEST))
#define GXML_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GXML_TEST, GXmlTestClass))

typedef struct _GXmlTest GXmlTest;
typedef struct _GXmlTestClass GXmlTestClass;
typedef struct _GXmlTestPrivate GXmlTestPrivate;

#define TYPE_TCDATA_TEST (tcdata_test_get_type ())
#define TCDATA_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TCDATA_TEST, TCDATATest))
#define TCDATA_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TCDATA_TEST, TCDATATestClass))
#define IS_TCDATA_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TCDATA_TEST))
#define IS_TCDATA_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TCDATA_TEST))
#define TCDATA_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TCDATA_TEST, TCDATATestClass))

typedef struct _TCDATATest TCDATATest;
typedef struct _TCDATATestClass TCDATATestClass;
typedef struct _TCDATATestPrivate TCDATATestPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_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 _GXmlTest {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GXmlTestPrivate * priv;
};

struct _GXmlTestClass {
	GTypeClass parent_class;
	void (*finalize) (GXmlTest *self);
};

struct _TCDATATest {
	GXmlTest parent_instance;
	TCDATATestPrivate * priv;
};

struct _TCDATATestClass {
	GXmlTestClass parent_class;
};

static gpointer tcdata_test_parent_class = NULL;

gpointer gxml_test_ref (gpointer instance);
void gxml_test_unref (gpointer instance);
GParamSpec* param_spec_gxml_test (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
void value_set_gxml_test (GValue* value,
                          gpointer v_object);
void value_take_gxml_test (GValue* value,
                           gpointer v_object);
gpointer value_get_gxml_test (const GValue* value);
GType gxml_test_get_type (void) G_GNUC_CONST;
GType tcdata_test_get_type (void) G_GNUC_CONST;
void tcdata_test_add_tests (void);
static void __lambda228_ (void);
static void ___lambda228__gtest_func (void);
TCDATATest* tcdata_test_new (void);
TCDATATest* tcdata_test_construct (GType object_type);
GXmlTest* gxml_test_new (void);
GXmlTest* gxml_test_construct (GType object_type);

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gboolean result = FALSE;
	gchar* _tmp0_;
#line 1476 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, FALSE);
#line 1476 "glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, FALSE);
#line 1477 "glib-2.0.vapi"
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
#line 1477 "glib-2.0.vapi"
	result = _tmp0_ != NULL;
#line 1477 "glib-2.0.vapi"
	return result;
#line 123 "TCDATATest.c"
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result = NULL;
#line 1516 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1517 "glib-2.0.vapi"
	result = self;
#line 1517 "glib-2.0.vapi"
	return result;
#line 136 "TCDATATest.c"
}

static void
__lambda228_ (void)
{
	GError* _inner_error0_ = NULL;
	{
		GXmlTDocument* d = NULL;
		GXmlTDocument* _tmp0_;
		GXmlNode* r = NULL;
		GXmlNode* _tmp1_;
		GeeBidirList* _tmp2_;
		GeeBidirList* _tmp3_;
		GeeBidirList* _tmp4_;
		GeeBidirList* _tmp5_;
		GeeBidirList* _tmp6_;
		GeeBidirList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		GXmlNode* cd = NULL;
		GXmlNode* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		GXmlNode* _tmp16_;
		GXmlNode* _tmp17_;
		GXmlNode* _tmp18_;
		GeeBidirList* _tmp19_;
		GeeBidirList* _tmp20_;
		GeeBidirList* _tmp21_;
		GXmlNode* _tmp22_;
		GXmlNode* _tmp23_;
		GXmlNode* _tmp24_;
		GeeBidirList* _tmp25_;
		GeeBidirList* _tmp26_;
		GeeBidirList* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		gchar* str = NULL;
		gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
#line 29 "TCDATATest.vala"
		_tmp0_ = gxml_tdocument_new ();
#line 29 "TCDATATest.vala"
		d = _tmp0_;
#line 30 "TCDATATest.vala"
		_tmp1_ = gxml_document_create_element ((GXmlDocument*) d, "root", &_inner_error0_);
#line 30 "TCDATATest.vala"
		r = _tmp1_;
#line 30 "TCDATATest.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 30 "TCDATATest.vala"
			_g_object_unref0 (d);
#line 193 "TCDATATest.c"
			goto __catch280_g_error;
		}
#line 31 "TCDATATest.vala"
		_tmp2_ = gxml_tnode_get_children_nodes ((GXmlTNode*) d);
#line 31 "TCDATATest.vala"
		_tmp3_ = _tmp2_;
#line 31 "TCDATATest.vala"
		_tmp4_ = _tmp3_;
#line 31 "TCDATATest.vala"
		gee_collection_add ((GeeCollection*) _tmp4_, r);
#line 31 "TCDATATest.vala"
		_g_object_unref0 (_tmp4_);
#line 32 "TCDATATest.vala"
		_tmp5_ = gxml_tnode_get_children_nodes ((GXmlTNode*) d);
#line 32 "TCDATATest.vala"
		_tmp6_ = _tmp5_;
#line 32 "TCDATATest.vala"
		_tmp7_ = _tmp6_;
#line 32 "TCDATATest.vala"
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
#line 32 "TCDATATest.vala"
		_tmp9_ = _tmp8_;
#line 32 "TCDATATest.vala"
		_vala_assert (_tmp9_ == 1, "d.children_nodes.size == 1");
#line 32 "TCDATATest.vala"
		_g_object_unref0 (_tmp7_);
#line 33 "TCDATATest.vala"
		_tmp10_ = gxml_tnode_to_string ((GXmlTNode*) d);
#line 33 "TCDATATest.vala"
		_tmp11_ = _tmp10_;
#line 33 "TCDATATest.vala"
		g_test_message ("%s", _tmp11_);
#line 33 "TCDATATest.vala"
		_g_free0 (_tmp11_);
#line 34 "TCDATATest.vala"
		_tmp12_ = gxml_document_create_cdata ((GXmlDocument*) d, "<test/>");
#line 34 "TCDATATest.vala"
		cd = _tmp12_;
#line 35 "TCDATATest.vala"
		_tmp13_ = gxml_node_get_value (cd);
#line 35 "TCDATATest.vala"
		_tmp14_ = _tmp13_;
#line 35 "TCDATATest.vala"
		_tmp15_ = _tmp14_;
#line 35 "TCDATATest.vala"
		_vala_assert (g_strcmp0 (_tmp15_, "<test/>") == 0, "cd.value == \"<test/>\"");
#line 35 "TCDATATest.vala"
		_g_free0 (_tmp15_);
#line 36 "TCDATATest.vala"
		_tmp16_ = gxml_document_get_root ((GXmlDocument*) d);
#line 36 "TCDATATest.vala"
		_tmp17_ = _tmp16_;
#line 36 "TCDATATest.vala"
		_tmp18_ = _tmp17_;
#line 36 "TCDATATest.vala"
		_tmp19_ = gxml_node_get_children_nodes (_tmp18_);
#line 36 "TCDATATest.vala"
		_tmp20_ = _tmp19_;
#line 36 "TCDATATest.vala"
		_tmp21_ = _tmp20_;
#line 36 "TCDATATest.vala"
		gee_collection_add ((GeeCollection*) _tmp21_, cd);
#line 36 "TCDATATest.vala"
		_g_object_unref0 (_tmp21_);
#line 36 "TCDATATest.vala"
		_g_object_unref0 (_tmp18_);
#line 37 "TCDATATest.vala"
		_tmp22_ = gxml_document_get_root ((GXmlDocument*) d);
#line 37 "TCDATATest.vala"
		_tmp23_ = _tmp22_;
#line 37 "TCDATATest.vala"
		_tmp24_ = _tmp23_;
#line 37 "TCDATATest.vala"
		_tmp25_ = gxml_node_get_children_nodes (_tmp24_);
#line 37 "TCDATATest.vala"
		_tmp26_ = _tmp25_;
#line 37 "TCDATATest.vala"
		_tmp27_ = _tmp26_;
#line 37 "TCDATATest.vala"
		_tmp28_ = gee_collection_get_size ((GeeCollection*) _tmp27_);
#line 37 "TCDATATest.vala"
		_tmp29_ = _tmp28_;
#line 37 "TCDATATest.vala"
		_vala_assert (_tmp29_ == 1, "d.root.children_nodes.size == 1");
#line 37 "TCDATATest.vala"
		_g_object_unref0 (_tmp27_);
#line 37 "TCDATATest.vala"
		_g_object_unref0 (_tmp24_);
#line 38 "TCDATATest.vala"
		_tmp30_ = gxml_tnode_to_string ((GXmlTNode*) d);
#line 38 "TCDATATest.vala"
		str = _tmp30_;
#line 39 "TCDATATest.vala"
		_tmp31_ = gxml_tnode_to_string ((GXmlTNode*) d);
#line 39 "TCDATATest.vala"
		_tmp32_ = _tmp31_;
#line 39 "TCDATATest.vala"
		g_test_message ("%s", _tmp32_);
#line 39 "TCDATATest.vala"
		_g_free0 (_tmp32_);
#line 40 "TCDATATest.vala"
		_vala_assert (string_contains (str, "<root><![CDATA[<test/>]]></root>"), "\"<root><![CDATA[<test/>]]></root>\" in str");
#line 28 "TCDATATest.vala"
		_g_free0 (str);
#line 28 "TCDATATest.vala"
		_g_object_unref0 (cd);
#line 28 "TCDATATest.vala"
		_g_object_unref0 (r);
#line 28 "TCDATATest.vala"
		_g_object_unref0 (d);
#line 304 "TCDATATest.c"
	}
	goto __finally280;
	__catch280_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp33_;
		const gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
#line 28 "TCDATATest.vala"
		e = _inner_error0_;
#line 28 "TCDATATest.vala"
		_inner_error0_ = NULL;
#line 43 "TCDATATest.vala"
		_tmp33_ = e->message;
#line 43 "TCDATATest.vala"
		_tmp34_ = string_to_string (_tmp33_);
#line 43 "TCDATATest.vala"
		_tmp35_ = g_strconcat ("ERROR: ", _tmp34_, NULL);
#line 43 "TCDATATest.vala"
		_tmp36_ = _tmp35_;
#line 43 "TCDATATest.vala"
		g_message ("TCDATATest.vala:43: %s", _tmp36_);
#line 43 "TCDATATest.vala"
		_g_free0 (_tmp36_);
#line 44 "TCDATATest.vala"
		g_assert_not_reached ();
#line 28 "TCDATATest.vala"
		_g_error_free0 (e);
#line 334 "TCDATATest.c"
	}
	__finally280:
#line 28 "TCDATATest.vala"
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 28 "TCDATATest.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 28 "TCDATATest.vala"
		g_clear_error (&_inner_error0_);
#line 28 "TCDATATest.vala"
		return;
#line 345 "TCDATATest.c"
	}
}

static void
___lambda228__gtest_func (void)
{
#line 27 "TCDATATest.vala"
	__lambda228_ ();
#line 354 "TCDATATest.c"
}

void
tcdata_test_add_tests (void)
{
#line 27 "TCDATATest.vala"
	g_test_add_func ("/gxml/t-cdata", ___lambda228__gtest_func);
#line 362 "TCDATATest.c"
}

TCDATATest*
tcdata_test_construct (GType object_type)
{
	TCDATATest* self = NULL;
#line 25 "TCDATATest.vala"
	self = (TCDATATest*) gxml_test_construct (object_type);
#line 25 "TCDATATest.vala"
	return self;
#line 373 "TCDATATest.c"
}

TCDATATest*
tcdata_test_new (void)
{
#line 25 "TCDATATest.vala"
	return tcdata_test_construct (TYPE_TCDATA_TEST);
#line 381 "TCDATATest.c"
}

static void
tcdata_test_class_init (TCDATATestClass * klass,
                        gpointer klass_data)
{
#line 25 "TCDATATest.vala"
	tcdata_test_parent_class = g_type_class_peek_parent (klass);
#line 390 "TCDATATest.c"
}

static void
tcdata_test_instance_init (TCDATATest * self,
                           gpointer klass)
{
}

GType
tcdata_test_get_type (void)
{
	static volatile gsize tcdata_test_type_id__volatile = 0;
	if (g_once_init_enter (&tcdata_test_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TCDATATestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tcdata_test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TCDATATest), 0, (GInstanceInitFunc) tcdata_test_instance_init, NULL };
		GType tcdata_test_type_id;
		tcdata_test_type_id = g_type_register_static (TYPE_GXML_TEST, "TCDATATest", &g_define_type_info, 0);
		g_once_init_leave (&tcdata_test_type_id__volatile, tcdata_test_type_id);
	}
	return tcdata_test_type_id__volatile;
}

