diff --git a/libguac/configure.in b/libguac/configure.in index bfcd41f4..000bc3b3 100644 --- a/libguac/configure.in +++ b/libguac/configure.in @@ -68,8 +68,9 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([clock_gettime gettimeofday memmove memset select strdup png_get_io_ptr nanosleep]) -# Check for "Check" (for unit tests) -PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) +# Check for unit testing library +AC_CHECK_LIB([cunit], [CU_run_test], [CUNIT_LIBS=-lcunit]) +AC_SUBST(CUNIT_LIBS) AC_CONFIG_FILES([Makefile src/Makefile diff --git a/libguac/tests/Makefile.am b/libguac/tests/Makefile.am index 1027b5d7..d09a89c9 100644 --- a/libguac/tests/Makefile.am +++ b/libguac/tests/Makefile.am @@ -40,6 +40,5 @@ ACLOCAL_AMFLAGS = -I m4 TESTS = test_protocol check_PROGRAMS = test_protocol test_protocol_SOURCES = test_protocol.c -test_protocol_CFLAGS = @CHECK_CFLAGS@ -test_protocol_LDADD = $(top_builddir)/src/libguac.la @CHECK_LIBS@ +test_protocol_LDADD = $(top_builddir)/src/libguac.la @CUNIT_LIBS@ diff --git a/libguac/tests/test_protocol.c b/libguac/tests/test_protocol.c index 053312be..6bff4a8b 100644 --- a/libguac/tests/test_protocol.c +++ b/libguac/tests/test_protocol.c @@ -35,7 +35,47 @@ * * ***** END LICENSE BLOCK ***** */ -int main() { +#include + +int init_suite() { return 0; } +int cleanup_suite() { + return 0; +} + +void test_unicode() { +} + +int main() { + + CU_pSuite pSuite; + + /* Init registry */ + if (CU_initialize_registry() != CUE_SUCCESS) + return CU_get_error(); + + /* Add protocol test suite */ + pSuite = CU_add_suite("protocol", init_suite, cleanup_suite); + if (pSuite == NULL) { + CU_cleanup_registry(); + return CU_get_error(); + } + + /* Add tests */ + if ( + CU_add_test(pSuite, "unicode-support", test_unicode) == NULL + ) { + CU_cleanup_registry(); + return CU_get_error(); + } + + /* Run tests */ + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_basic_run_tests(); + CU_cleanup_registry(); + return CU_get_error(); + +} +