File: test-fixture.c

package info (click to toggle)
evolution-data-server 3.30.5-1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 42,812 kB
  • sloc: ansic: 340,864; cpp: 468; xml: 455; perl: 297; sh: 62; makefile: 49; python: 35
file content (132 lines) | stat: -rw-r--r-- 3,829 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/* test-fixture.c - Test to ensure the server test fixture works.
 *
 * Copyright (C) 2012 Intel Corporation
 *
 * This program 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.
 *
 * This program 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 program. If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Tristan Van Berkom <tristanvb@openismus.com>
 */

#include "e-test-server-utils.h"

#define N_CYCLES 10

static ETestServerClosure registry_closure = { E_TEST_SERVER_NONE, NULL, 0 };
static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
static ETestServerClosure calendar_closure = { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS };
static ETestServerClosure deprecated_book_closure = { E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK, NULL, 0 };
static ETestServerClosure deprecated_calendar_closure = { E_TEST_SERVER_DEPRECATED_CALENDAR, NULL, E_CAL_SOURCE_TYPE_EVENT };

static void
empty_test (ETestServerFixture *fixture,
            gconstpointer user_data)
{
	/* Basic Empty case just to run the fixture */
}

gint
main (gint argc,
      gchar *argv[])
{
	gchar **registry_keys;
	gchar **book_keys;
	gchar **calendar_keys;
	gchar **deprecated_book_keys;
	gchar **deprecated_calendar_keys;
	gint i;
	gint ret;

	g_test_init (&argc, &argv, NULL);
	g_test_bug_base ("http://bugzilla.gnome.org/");

	registry_keys = g_new0 (gchar *, N_CYCLES);
	book_keys = g_new0 (gchar *, N_CYCLES);
	calendar_keys = g_new0 (gchar *, N_CYCLES);
	deprecated_book_keys = g_new0 (gchar *, N_CYCLES);
	deprecated_calendar_keys = g_new0 (gchar *, N_CYCLES);

	for (i = 0; i < N_CYCLES; i++) {
		registry_keys[i] = g_strdup_printf ("/Fixture/Registry%d", i);
		g_test_add (
			registry_keys[i],
			ETestServerFixture,
			&registry_closure,
			e_test_server_utils_setup,
			empty_test,
			e_test_server_utils_teardown);
	}

	for (i = 0; i < N_CYCLES; i++) {
		book_keys[i] = g_strdup_printf ("/Fixture/Book%d", i);
		g_test_add (
			book_keys[i],
			ETestServerFixture,
			&book_closure,
			e_test_server_utils_setup,
			empty_test,
			e_test_server_utils_teardown);
	}

	for (i = 0; i < N_CYCLES; i++) {
		calendar_keys[i] = g_strdup_printf ("/Fixture/Calendar%d", i);
		g_test_add (
			calendar_keys[i],
			ETestServerFixture,
			&calendar_closure,
			e_test_server_utils_setup,
			empty_test,
			e_test_server_utils_teardown);
	}

	for (i = 0; i < N_CYCLES; i++) {
		deprecated_book_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Book%d", i);
		g_test_add (
			deprecated_book_keys[i],
			ETestServerFixture,
			&deprecated_book_closure,
			e_test_server_utils_setup,
			empty_test,
			e_test_server_utils_teardown);
	}

	for (i = 0; i < N_CYCLES; i++) {
		deprecated_calendar_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Calendar%d", i);
		g_test_add (
			deprecated_calendar_keys[i],
			ETestServerFixture,
			&deprecated_calendar_closure,
			e_test_server_utils_setup,
			empty_test,
			e_test_server_utils_teardown);
	}

	ret = e_test_server_utils_run ();

	for (i = 0; i < N_CYCLES; i++) {
		g_free (registry_keys[i]);
		g_free (book_keys[i]);
		g_free (calendar_keys[i]);
		g_free (deprecated_book_keys[i]);
		g_free (deprecated_calendar_keys[i]);
	}

	g_free (registry_keys);
	g_free (book_keys);
	g_free (calendar_keys);
	g_free (deprecated_book_keys);
	g_free (deprecated_calendar_keys);

	return ret;
}