elput: Add test framework for Elput library

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
Chris Michael 2016-03-24 13:38:44 -04:00
parent f8964fcf2e
commit 08482e1ca4
4 changed files with 93 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
#ifndef _ELPUT_SUITE_H
# define _ELPUT_SUITE_H
# include <check.h>
void elput_test_elput(TCase *tc);
#endif

View File

@ -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);
}