Diff between 41ccb16f6c95c73468fd0d526b06388643754df4 and 9d387f43726c170f12420158edb6fb0e3fdca0fb

Changed Files

File Additions Deletions Status
Makefile.am +2 -1 modified
configure.ac +2 -0 modified
unit/test-eir.c +34 -7 modified

Full Patch

diff --git a/Makefile.am b/Makefile.am
index 138ab32..283af4d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -450,7 +450,8 @@ unit_tests = unit/test-eir
 noinst_PROGRAMS += $(unit_tests)
 
 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/glib-helper.c
-unit_test_eir_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@
+unit_test_eir_CFLAGS = @GLIB_CFLAGS@ @CHECK_CFLAGS@
+unit_test_eir_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@ @CHECK_LIBS@
 unit_objects += $(unit_test_eir_OBJECTS)
 
 TESTS = $(unit_tests)
diff --git a/configure.ac b/configure.ac
index 50ca5dc..50ab543 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,8 @@ AC_PROG_YACC
 AM_PROG_LEX
 AM_PROG_MKDIR_P
 
+AM_PATH_CHECK
+
 m4_define([_LT_AC_TAGCONFIG], [])
 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
 
diff --git a/unit/test-eir.c b/unit/test-eir.c
index f25b58e..cefcacd 100644
--- a/unit/test-eir.c
+++ b/unit/test-eir.c
@@ -25,6 +25,8 @@
 #include <config.h>
 #endif
 
+#include <check.h>
+
 #include <stdint.h>
 
 #include <glib.h>
@@ -35,7 +37,7 @@
 
 #include "eir.h"
 
-static void test_basic(void)
+START_TEST(test_basic)
 {
 	struct eir_data data;
 	unsigned char buf[HCI_MAX_EIR_LENGTH];
@@ -45,18 +47,43 @@ static void test_basic(void)
 	memset(&data, 0, sizeof(data));
 
 	err = eir_parse(&data, buf, HCI_MAX_EIR_LENGTH);
-	g_assert(err == 0);
-	g_assert(data.services == NULL);
-	g_assert(data.name == NULL);
+	ck_assert(err == 0);
+	ck_assert(data.services == NULL);
+	ck_assert(data.name == NULL);
 
 	eir_data_free(&data);
 }
+END_TEST
+
+static void add_test(Suite *s, const char *name, TFun func)
+{
+	TCase *t;
+
+	t = tcase_create(name);
+	tcase_add_test(t, func);
+	suite_add_tcase(s, t);
+}
 
 int main(int argc, char *argv[])
 {
-	g_test_init(&argc, &argv, NULL);
+	int fails;
+	SRunner *sr;
+	Suite *s;
+
+	s = suite_create("EIR");
+
+	add_test(s, "basic", test_basic);
+
+	sr = srunner_create(s);
+
+	srunner_run_all(sr, CK_NORMAL);
+
+	fails = srunner_ntests_failed(sr);
+
+	srunner_free(sr);
 
-	g_test_add_func("/eir/test_basic", test_basic);
+	if (fails > 0)
+		return -1;
 
-	return g_test_run();
+	return 0;
 }