Commit e0476346 authored by Julien Bonjean's avatar Julien Bonjean

Introduced unit tests (#1146)

parent b1e0eaba
SUBDIRS = src pixmaps
SUBDIRS = src pixmaps tests
ACLOCAL_AMFLAGS = -I m4
......
......@@ -42,6 +42,13 @@ PKG_CHECK_MODULES(DEPS, \
libebook-1.2 >= 2.22
)
# This macro is defined in check.m4 and tests if check.h and
# libcheck.a are installed in your system. It sets CHECK_CFLAGS and
# CHECK_LIBS accordingly.
# AM_PATH_CHECK([MINIMUM-VERSION,
# [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AM_PATH_CHECK()
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
......@@ -54,6 +61,7 @@ src/contacts/Makefile
src/contacts/addressbook/Makefile
pixmaps/Makefile
sflphone.desktop
tests/Makefile
])
include ../globals.mak
TESTS = check_global check_contacts check_config check_dbus
check_PROGRAMS = check_global check_contacts check_config check_dbus
###########################################################
check_global_SOURCES = check_global.c
check_global_CFLAGS = @CHECK_CFLAGS@ @DEPS_CFLAGS@
check_global_LDADD = @CHECK_LIBS@
###########################################################
check_contacts_SOURCES = check_contacts.c
$(top_builddir)/src/eds.h
check_contacts_CFLAGS = @CHECK_CFLAGS@ @DEPS_CFLAGS@
check_contacts_LDADD = @CHECK_LIBS@
###########################################################
check_config_SOURCES = check_config.c
check_config_CFLAGS = @CHECK_CFLAGS@ @DEPS_CFLAGS@
check_config_LDADD = @CHECK_LIBS@
###########################################################
check_dbus_SOURCES = check_dbus.c
check_dbus_CFLAGS = @CHECK_CFLAGS@ @DEPS_CFLAGS@
check_dbus_LDADD = @CHECK_LIBS@
###########################################################
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <check.h>
#include <stdlib.h>
Suite *
config_suite (void)
{
Suite *s = suite_create ("Config");
return s;
}
int
main (void)
{
int number_failed;
Suite *s = config_suite ();
SRunner *sr = srunner_create (s);
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <check.h>
#include <stdlib.h>
#include "../src/contacts/addressbook/eds.h"
START_TEST (test_eds)
{
fail_unless (5 == 5,"Erreur");
}
END_TEST
Suite *
contacts_suite (void)
{
Suite *s = suite_create ("Contacts");
TCase *tc_cases = tcase_create ("EDS");
tcase_add_test (tc_cases, test_eds);
suite_add_tcase (s, tc_cases);
return s;
}
int
main (void)
{
int number_failed;
Suite *s = contacts_suite ();
SRunner *sr = srunner_create (s);
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <check.h>
#include <stdlib.h>
Suite *
dbus_suite (void)
{
Suite *s = suite_create ("DBus");
return s;
}
int
main (void)
{
int number_failed;
Suite *s = dbus_suite ();
SRunner *sr = srunner_create (s);
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <check.h>
#include <stdlib.h>
Suite *
global_suite (void)
{
Suite *s = suite_create ("Global");
return s;
}
int
main (void)
{
int number_failed;
Suite *s = global_suite ();
SRunner *sr = srunner_create (s);
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment