devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=08482e1ca4feaff2c631a125b58fda7e57084b97
commit 08482e1ca4feaff2c631a125b58fda7e57084b97 Author: Chris Michael <[email protected]> Date: Thu Mar 24 13:38:44 2016 -0400 elput: Add test framework for Elput library Signed-off-by: Chris Michael <[email protected]> --- src/Makefile_Elput.am | 27 +++++++++++++++++++++++++++ src/tests/elput/elput_suite.c | 29 +++++++++++++++++++++++++++++ src/tests/elput/elput_suite.h | 8 ++++++++ src/tests/elput/elput_test_elput.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+) diff --git a/src/Makefile_Elput.am b/src/Makefile_Elput.am index 73fe8f9..851d4ee 100644 --- a/src/Makefile_Elput.am +++ b/src/Makefile_Elput.am @@ -25,4 +25,31 @@ endif lib_elput_libelput_la_DEPENDENCIES = @ELPUT_INTERNAL_LIBS@ lib_elput_libelput_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ +### Unit tests + +if EFL_ENABLE_TESTS + +check_PROGRAMS += tests/elput/elput_suite +TESTS += tests/elput/elput_suite + +tests_elput_elput_suite_SOURCES = \ +tests/elput/elput_suite.c \ +tests/elput/elput_test_elput.c \ +tests/elput/elput_suite.h + +tests_elput_elput_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/elput\" \ +-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/elput\" \ +@CHECK_CFLAGS@ \ +@ELPUT_CFLAGS@ + +tests_elput_elput_suite_LDADD = \ +@CHECK_LIBS@ \ +@USE_ELPUT_LIBS@ + +tests_elput_elput_suite_DEPENDENCIES = \ +@USE_ELPUT_INTERNAL_LIBS@ + +endif + endif diff --git a/src/tests/elput/elput_suite.c b/src/tests/elput/elput_suite.c new file mode 100644 index 0000000..b56b84e --- /dev/null +++ b/src/tests/elput/elput_suite.c @@ -0,0 +1,29 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "elput_suite.h" +#include "../efl_check.h" + +static const Efl_Test_Case etc[] = +{ +#if HAVE_ELPUT + { "Elput", elput_test_elput }, +#endif + { NULL, NULL } +}; + +int +main(int argc, char **argv) +{ + int count; + + if (!_efl_test_option_disp(argc, argv, etc)) return 0; + + putenv("EFL_RUN_IN_TREE=1"); + + count = + _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, "Elput", etc); + + return (count == 0) ? 0 : 255; +} diff --git a/src/tests/elput/elput_suite.h b/src/tests/elput/elput_suite.h new file mode 100644 index 0000000..34a7ffd --- /dev/null +++ b/src/tests/elput/elput_suite.h @@ -0,0 +1,8 @@ +#ifndef _ELPUT_SUITE_H +# define _ELPUT_SUITE_H + +# include <check.h> + +void elput_test_elput(TCase *tc); + +#endif diff --git a/src/tests/elput/elput_test_elput.c b/src/tests/elput/elput_test_elput.c new file mode 100644 index 0000000..8207ee8 --- /dev/null +++ b/src/tests/elput/elput_test_elput.c @@ -0,0 +1,29 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <unistd.h> + +#include <Eina.h> +#include <Ecore.h> +#include <Elput.h> + +#include "elput_suite.h" + +START_TEST(elput_test_elput_init) +{ + int ret; + + ret = elput_init(); + fail_if(ret < 1); + + ret = elput_shutdown(); + fail_if(ret != 0); +} +END_TEST + +void elput_test_elput(TCase *tc) +{ + tcase_add_test(tc, elput_test_elput_init); +} --
