diff --git a/sflphone-gtk/Makefile.am b/sflphone-gtk/Makefile.am index 8e9dc0e013df0d8f2a3afd4ac4a5611da8337f84..5705a85e233eaa9ee7383ef7288e6e961f6629e9 100644 --- a/sflphone-gtk/Makefile.am +++ b/sflphone-gtk/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src pixmaps +SUBDIRS = src pixmaps tests ACLOCAL_AMFLAGS = -I m4 diff --git a/sflphone-gtk/configure.ac b/sflphone-gtk/configure.ac index ce4933b6ff5facd6aa11a3cbe29bb1bcb0c58ab9..85b9b4d0933521e091b923fc803078fb59f1125f 100644 --- a/sflphone-gtk/configure.ac +++ b/sflphone-gtk/configure.ac @@ -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 ]) diff --git a/sflphone-gtk/tests/Makefile.am b/sflphone-gtk/tests/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..db54b0b09b142d0669e7717f6a29749e647203a2 --- /dev/null +++ b/sflphone-gtk/tests/Makefile.am @@ -0,0 +1,31 @@ +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@ + +########################################################### diff --git a/sflphone-gtk/tests/check_config.c b/sflphone-gtk/tests/check_config.c new file mode 100644 index 0000000000000000000000000000000000000000..ae41e1a280ff24bb365fe43a93e064c85b609049 --- /dev/null +++ b/sflphone-gtk/tests/check_config.c @@ -0,0 +1,41 @@ +/* + * 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; +} diff --git a/sflphone-gtk/tests/check_contacts.c b/sflphone-gtk/tests/check_contacts.c new file mode 100644 index 0000000000000000000000000000000000000000..6fcefe6d4ef333105a83acdb04bc5d45bcd62ee0 --- /dev/null +++ b/sflphone-gtk/tests/check_contacts.c @@ -0,0 +1,55 @@ +/* + * 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; +} diff --git a/sflphone-gtk/tests/check_dbus.c b/sflphone-gtk/tests/check_dbus.c new file mode 100644 index 0000000000000000000000000000000000000000..67423ee2c29df51bd14749d950450f1b9f02c19f --- /dev/null +++ b/sflphone-gtk/tests/check_dbus.c @@ -0,0 +1,41 @@ +/* + * 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; +} diff --git a/sflphone-gtk/tests/check_global.c b/sflphone-gtk/tests/check_global.c new file mode 100644 index 0000000000000000000000000000000000000000..5d64a94e93e5eab9104786d1a2d5bbc6064e63bf --- /dev/null +++ b/sflphone-gtk/tests/check_global.c @@ -0,0 +1,41 @@ +/* + * 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; +}