/* phone-field-details.c generated by valac 0.24.0.16-c045, the Vala compiler
 * generated from phone-field-details.vala, do not modify */

/*
 * Copyright (C) 2013 Philip Withnall
 *
 * 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: Philip Withnall <philip@tecnocode.co.uk>
 */

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


#define TYPE_PHONE_FIELD_DETAILS_TESTS (phone_field_details_tests_get_type ())
#define PHONE_FIELD_DETAILS_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHONE_FIELD_DETAILS_TESTS, PhoneFieldDetailsTests))
#define PHONE_FIELD_DETAILS_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHONE_FIELD_DETAILS_TESTS, PhoneFieldDetailsTestsClass))
#define IS_PHONE_FIELD_DETAILS_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHONE_FIELD_DETAILS_TESTS))
#define IS_PHONE_FIELD_DETAILS_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHONE_FIELD_DETAILS_TESTS))
#define PHONE_FIELD_DETAILS_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHONE_FIELD_DETAILS_TESTS, PhoneFieldDetailsTestsClass))

typedef struct _PhoneFieldDetailsTests PhoneFieldDetailsTests;
typedef struct _PhoneFieldDetailsTestsClass PhoneFieldDetailsTestsClass;
typedef struct _PhoneFieldDetailsTestsPrivate PhoneFieldDetailsTestsPrivate;

#define PHONE_FIELD_DETAILS_TESTS_TYPE_NORMALISATION_PAIR (phone_field_details_tests_normalisation_pair_get_type ())
typedef struct _PhoneFieldDetailsTestsNormalisationPair PhoneFieldDetailsTestsNormalisationPair;
#define _g_free0(var) (var = (g_free (var), NULL))
#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 _PhoneFieldDetailsTests {
	FolksTestCase parent_instance;
	PhoneFieldDetailsTestsPrivate * priv;
};

struct _PhoneFieldDetailsTestsClass {
	FolksTestCaseClass parent_class;
};

struct _PhoneFieldDetailsTestsNormalisationPair {
	const gchar* unnormalised;
	const gchar* normalised;
};


static gpointer phone_field_details_tests_parent_class = NULL;

GType phone_field_details_tests_get_type (void) G_GNUC_CONST;
enum  {
	PHONE_FIELD_DETAILS_TESTS_DUMMY_PROPERTY
};
PhoneFieldDetailsTests* phone_field_details_tests_new (void);
PhoneFieldDetailsTests* phone_field_details_tests_construct (GType object_type);
void phone_field_details_tests_test_normalisation (PhoneFieldDetailsTests* self);
static void _phone_field_details_tests_test_normalisation_folks_test_case_test_method (gpointer self);
static GType phone_field_details_tests_normalisation_pair_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static PhoneFieldDetailsTestsNormalisationPair* phone_field_details_tests_normalisation_pair_dup (const PhoneFieldDetailsTestsNormalisationPair* self);
static void phone_field_details_tests_normalisation_pair_free (PhoneFieldDetailsTestsNormalisationPair* self);
gint _vala_main (gchar** args, int args_length1);


static void _phone_field_details_tests_test_normalisation_folks_test_case_test_method (gpointer self) {
#line 29 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	phone_field_details_tests_test_normalisation ((PhoneFieldDetailsTests*) self);
#line 83 "phone-field-details.c"
}


PhoneFieldDetailsTests* phone_field_details_tests_construct (GType object_type) {
	PhoneFieldDetailsTests * self = NULL;
#line 27 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	self = (PhoneFieldDetailsTests*) folks_test_case_construct (object_type, "PhoneFieldDetails");
#line 29 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	folks_test_case_add_test ((FolksTestCase*) self, "normalisation", _phone_field_details_tests_test_normalisation_folks_test_case_test_method, self);
#line 25 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	return self;
#line 95 "phone-field-details.c"
}


PhoneFieldDetailsTests* phone_field_details_tests_new (void) {
#line 25 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	return phone_field_details_tests_construct (TYPE_PHONE_FIELD_DETAILS_TESTS);
#line 102 "phone-field-details.c"
}


void phone_field_details_tests_test_normalisation (PhoneFieldDetailsTests* self) {
#line 42 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	static const PhoneFieldDetailsTestsNormalisationPair normalisation_pairs[] = {{"1-800-123-4567", "18001234567"}, {"+1-800-123-4567", "+18001234567"}, {"+1-800-123-4567P123", "+18001234567P123"}, {"+1-800-123-4567p123", "+18001234567P123"}, {"#31#+123", "#31#+123"}, {"*31#+123", "*31#+123"}};
#line 38 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	g_return_if_fail (self != NULL);
#line 111 "phone-field-details.c"
	{
		PhoneFieldDetailsTestsNormalisationPair* s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
#line 51 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
		s_collection = normalisation_pairs;
#line 51 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
		s_collection_length1 = G_N_ELEMENTS (normalisation_pairs);
#line 51 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
		for (s_it = 0; s_it < G_N_ELEMENTS (normalisation_pairs); s_it = s_it + 1) {
#line 123 "phone-field-details.c"
			PhoneFieldDetailsTestsNormalisationPair s = {0};
#line 51 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
			s = s_collection[s_it];
#line 127 "phone-field-details.c"
			{
				FolksPhoneFieldDetails* pfd1 = NULL;
				PhoneFieldDetailsTestsNormalisationPair _tmp0_ = {0};
				const gchar* _tmp1_ = NULL;
				FolksPhoneFieldDetails* _tmp2_ = NULL;
				FolksPhoneFieldDetails* _tmp3_ = NULL;
				gchar* _tmp4_ = NULL;
				gchar* _tmp5_ = NULL;
				PhoneFieldDetailsTestsNormalisationPair _tmp6_ = {0};
				const gchar* _tmp7_ = NULL;
#line 53 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp0_ = s;
#line 53 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp1_ = _tmp0_.unnormalised;
#line 53 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp2_ = folks_phone_field_details_new (_tmp1_, NULL);
#line 53 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				pfd1 = _tmp2_;
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp3_ = pfd1;
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp4_ = folks_phone_field_details_get_normalised (_tmp3_);
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp5_ = _tmp4_;
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp6_ = s;
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_tmp7_ = _tmp6_.normalised;
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_vala_assert (g_strcmp0 (_tmp5_, _tmp7_) == 0, "pfd1.get_normalised () == s.normalised");
#line 54 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_g_free0 (_tmp5_);
#line 51 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
				_g_object_unref0 (pfd1);
#line 162 "phone-field-details.c"
			}
		}
	}
}


static PhoneFieldDetailsTestsNormalisationPair* phone_field_details_tests_normalisation_pair_dup (const PhoneFieldDetailsTestsNormalisationPair* self) {
	PhoneFieldDetailsTestsNormalisationPair* dup;
#line 32 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	dup = g_new0 (PhoneFieldDetailsTestsNormalisationPair, 1);
#line 32 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	memcpy (dup, self, sizeof (PhoneFieldDetailsTestsNormalisationPair));
#line 32 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	return dup;
#line 177 "phone-field-details.c"
}


static void phone_field_details_tests_normalisation_pair_free (PhoneFieldDetailsTestsNormalisationPair* self) {
#line 32 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	g_free (self);
#line 184 "phone-field-details.c"
}


static GType phone_field_details_tests_normalisation_pair_get_type (void) {
	static volatile gsize phone_field_details_tests_normalisation_pair_type_id__volatile = 0;
	if (g_once_init_enter (&phone_field_details_tests_normalisation_pair_type_id__volatile)) {
		GType phone_field_details_tests_normalisation_pair_type_id;
		phone_field_details_tests_normalisation_pair_type_id = g_boxed_type_register_static ("PhoneFieldDetailsTestsNormalisationPair", (GBoxedCopyFunc) phone_field_details_tests_normalisation_pair_dup, (GBoxedFreeFunc) phone_field_details_tests_normalisation_pair_free);
		g_once_init_leave (&phone_field_details_tests_normalisation_pair_type_id__volatile, phone_field_details_tests_normalisation_pair_type_id);
	}
	return phone_field_details_tests_normalisation_pair_type_id__volatile;
}


static void phone_field_details_tests_class_init (PhoneFieldDetailsTestsClass * klass) {
#line 23 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	phone_field_details_tests_parent_class = g_type_class_peek_parent (klass);
#line 202 "phone-field-details.c"
}


static void phone_field_details_tests_instance_init (PhoneFieldDetailsTests * self) {
}


GType phone_field_details_tests_get_type (void) {
	static volatile gsize phone_field_details_tests_type_id__volatile = 0;
	if (g_once_init_enter (&phone_field_details_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PhoneFieldDetailsTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) phone_field_details_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhoneFieldDetailsTests), 0, (GInstanceInitFunc) phone_field_details_tests_instance_init, NULL };
		GType phone_field_details_tests_type_id;
		phone_field_details_tests_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "PhoneFieldDetailsTests", &g_define_type_info, 0);
		g_once_init_leave (&phone_field_details_tests_type_id__volatile, phone_field_details_tests_type_id);
	}
	return phone_field_details_tests_type_id__volatile;
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	PhoneFieldDetailsTests* tests = NULL;
	PhoneFieldDetailsTests* _tmp0_ = NULL;
#line 61 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	g_test_init (&args_length1, &args, NULL);
#line 63 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	_tmp0_ = phone_field_details_tests_new ();
#line 63 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	tests = _tmp0_;
#line 64 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	folks_test_case_register ((FolksTestCase*) tests);
#line 65 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	g_test_run ();
#line 66 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	folks_test_case_final_tear_down ((FolksTestCase*) tests);
#line 68 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	result = 0;
#line 68 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	_g_object_unref0 (tests);
#line 68 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	return result;
#line 244 "phone-field-details.c"
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
#line 59 "/opt/gnome3/source/folks/tests/folks/phone-field-details.vala"
	return _vala_main (argv, argc);
#line 254 "phone-field-details.c"
}



