1
0
Fork 0

Add check unit testing framework w/ 2 dummy tests

This commit is contained in:
Moritz Grimm 2015-05-06 23:45:52 +02:00
parent 33eb55ae34
commit f6ec4e1aeb
7 changed files with 109 additions and 9 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
test-driver

View File

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = 1.10 foreign subdir-objects
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = build-aux compat doc examples m4 src
SUBDIRS = build-aux compat doc examples m4 src tests
dist_doc_DATA = COPYING NEWS README

View File

@ -45,11 +45,18 @@ if test x"${ez_enable_debug}" = "xyes"; then
fi
AC_MSG_RESULT([$ez_enable_debug])
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
EZ_CFLAGS=""
EZ_CPPFLAGS=""
EZ_LDFLAGS=""
EZ_LIBS=""
AC_SYS_LARGEFILE
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
dnl ##############
dnl ## COMPILER ########################################################
@ -290,6 +297,7 @@ AC_CONFIG_FILES([
src/Makefile
src/attr_config.h
src/ezstream-file.sh
tests/Makefile
])
AC_OUTPUT

View File

@ -1,8 +1,6 @@
AUTOMAKE_OPTIONS = 1.10 foreign subdir-objects
bin_PROGRAMS = ezstream
bin_SCRIPTS = ezstream-file.sh
noinst_LTLIBRARIES = libezstream.la
noinst_HEADERS = \
attributes.h \
cfg.h \
@ -17,22 +15,30 @@ noinst_HEADERS = \
playlist.h \
util.h \
xalloc.h
ezstream_SOURCES = \
libezstream_la_SOURCES = \
cfg.c \
cfg_decoder.c \
cfg_encoder.c \
cfg_xmlfile.c \
cmdline.c \
ezstream.c \
log.c \
metadata.c \
playlist.c \
util.c \
xalloc.c
ezstream_LDADD = @LIBOBJS@ @EZ_LIBS@
libezstream_la_DEPENDENCIES =
libezstream_la_LIBADD = @LIBOBJS@ @EZ_LIBS@ \
$(libezstream_la_DEPENDENCIES)
bin_SCRIPTS = ezstream-file.sh
bin_PROGRAMS = ezstream
ezstream_SOURCES = ezstream.c
ezstream_DEPENDENCIES = libezstream.la
ezstream_LDADD = $(ezstream_DEPENDENCIES)
AM_CFLAGS = @EZ_CFLAGS@
AM_CPPFLAGS = @EZ_CPPFLAGS@ -I$(top_srcdir)/compat
AM_LDFLAGS = @EZ_LDFLAGS@
AM_CFLAGS = @EZ_CFLAGS@
AM_LDFLAGS = @EZ_LDFLAGS@ -avoid-version
CLEANFILES = core *.core *~ .*~

27
tests/Makefile.am Normal file
View File

@ -0,0 +1,27 @@
AUTOMAKE_OPTIONS = 1.10 foreign subdir-objects
TESTS = \
check_ezstream \
check_cfg
check_PROGRAMS = $(TESTS)
check_ezstream_SOURCES = \
check_ezstream.c
check_ezstream_DEPENDENCIES = $(top_builddir)/src/libezstream.la
check_ezstream_LDADD = $(check_ezstream_DEPENDENCIES) @CHECK_LIBS@
check_cfg_SOURCES = \
check_cfg.c
check_cfg_DEPENDENCIES = $(top_builddir)/src/libezstream.la
check_cfg_LDADD = $(check_cfg_DEPENDENCIES) @CHECK_LIBS@
AM_CPPFLAGS = @EZ_CPPFLAGS@ \
-I$(top_srcdir)/compat \
-I$(top_srcdir)/src \
-I$(top_builddir)/src
AM_CFLAGS = @EZ_CFLAGS@ @CHECK_CFLAGS@
AM_LDFLAGS = @EZ_LDFLAGS@
EXTRA_DIST = compat.h
CLEANFILES = *~ *.core core

12
tests/check_cfg.c Normal file
View File

@ -0,0 +1,12 @@
#include <check.h>
START_TEST(test_cfg)
{
}
END_TEST
int
main(void)
{
return (0);
}

46
tests/check_ezstream.c Normal file
View File

@ -0,0 +1,46 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include "compat.h"
#include <check.h>
START_TEST(test_ezstream)
{
}
END_TEST
Suite *
ezstream_suite(void)
{
Suite *s;
TCase *tc_core;
s = suite_create("Ezstream");
tc_core = tcase_create("Core");
tcase_add_test(tc_core, test_ezstream);
suite_add_tcase(s, tc_core);
return (s);
}
int
main(void)
{
unsigned int num_failed;
Suite *s;
SRunner *sr;
s = ezstream_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
num_failed = srunner_ntests_failed(sr);
srunner_free(sr);
if (num_failed)
return (1);
return (0);
}