1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 /* test-fixture.c - Test to ensure the server test fixture works.
5 * Copyright (C) 2012 Intel Corporation
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) version 3.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with the program; if not, see <http://www.gnu.org/licenses/>
20 * Authors: Tristan Van Berkom <tristanvb@openismus.com>
23 #include "e-test-server-utils.h"
27 static ETestServerClosure registry_closure = { E_TEST_SERVER_NONE, NULL, 0 };
28 static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
29 static ETestServerClosure calendar_closure = { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS };
30 static ETestServerClosure deprecated_book_closure = { E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK, NULL, 0 };
31 static ETestServerClosure deprecated_calendar_closure = { E_TEST_SERVER_DEPRECATED_CALENDAR, NULL, E_CAL_SOURCE_TYPE_EVENT };
34 empty_test (ETestServerFixture *fixture,
35 gconstpointer user_data)
37 /* Basic Empty case just to run the fixture */
44 gchar **registry_keys;
46 gchar **calendar_keys;
47 gchar **deprecated_book_keys;
48 gchar **deprecated_calendar_keys;
52 #if !GLIB_CHECK_VERSION (2, 35, 1)
55 g_test_init (&argc, &argv, NULL);
57 registry_keys = g_new0 (gchar *, N_CYCLES);
58 book_keys = g_new0 (gchar *, N_CYCLES);
59 calendar_keys = g_new0 (gchar *, N_CYCLES);
60 deprecated_book_keys = g_new0 (gchar *, N_CYCLES);
61 deprecated_calendar_keys = g_new0 (gchar *, N_CYCLES);
63 for (i = 0; i < N_CYCLES; i++) {
64 registry_keys[i] = g_strdup_printf ("/Fixture/Registry%d", i);
65 g_test_add (registry_keys[i], ETestServerFixture, ®istry_closure,
66 e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
69 for (i = 0; i < N_CYCLES; i++) {
70 book_keys[i] = g_strdup_printf ("/Fixture/Book%d", i);
71 g_test_add (book_keys[i], ETestServerFixture, &book_closure,
72 e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
75 for (i = 0; i < N_CYCLES; i++) {
76 calendar_keys[i] = g_strdup_printf ("/Fixture/Calendar%d", i);
77 g_test_add (calendar_keys[i], ETestServerFixture, &calendar_closure,
78 e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
81 for (i = 0; i < N_CYCLES; i++) {
82 deprecated_book_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Book%d", i);
83 g_test_add (deprecated_book_keys[i], ETestServerFixture, &deprecated_book_closure,
84 e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
87 for (i = 0; i < N_CYCLES; i++) {
88 deprecated_calendar_keys[i] = g_strdup_printf ("/Fixture/Deprecated/Calendar%d", i);
89 g_test_add (deprecated_calendar_keys[i], ETestServerFixture, &deprecated_calendar_closure,
90 e_test_server_utils_setup, empty_test, e_test_server_utils_teardown);
93 ret = e_test_server_utils_run ();
95 for (i = 0; i < N_CYCLES; i++) {
96 g_free (registry_keys[i]);
97 g_free (book_keys[i]);
98 g_free (calendar_keys[i]);
99 g_free (deprecated_book_keys[i]);
100 g_free (deprecated_calendar_keys[i]);
103 g_free (registry_keys);
105 g_free (calendar_keys);
106 g_free (deprecated_book_keys);
107 g_free (deprecated_calendar_keys);