]> code.delx.au - pulseaudio/commitdiff
tests: modify smoother-test to use 'check' framework
authorDeng Zhengrong <dzrongg@gmail.com>
Sat, 28 Jul 2012 21:59:46 +0000 (05:59 +0800)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 20 Aug 2012 01:35:59 +0000 (07:05 +0530)
src/Makefile.am
src/tests/smoother-test.c

index f27e4427c725478fc980cbba02b3797ad93fa601..8009b87c85504610a29a586f1e3e6a12b30d63a7 100644 (file)
@@ -476,8 +476,8 @@ remix_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 smoother_test_SOURCES = tests/smoother-test.c
 smoother_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
-smoother_test_CFLAGS = $(AM_CFLAGS)
-smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+smoother_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
+smoother_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
 
 proplist_test_SOURCES = tests/proplist-test.c
 proplist_test_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
index 4471669c52e265716b978a0de8d33be01e94f91f..c06f96d9afcbb754b004edcf392ea0e9bf37736b 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <check.h>
+
 #include <pulse/timeval.h>
 
 #include <pulsecore/log.h>
 #include <pulsecore/time-smoother.h>
 
-int main(int argc, char*argv[]) {
+START_TEST (smoother_test) {
     pa_usec_t x;
     unsigned u = 0;
     pa_smoother *s;
@@ -80,6 +82,24 @@ int main(int argc, char*argv[]) {
     }
 
     pa_smoother_free(s);
+}
+END_TEST
+
+int main(int argc, char *argv[]) {
+    int failed = 0;
+    Suite *s;
+    TCase *tc;
+    SRunner *sr;
+
+    s = suite_create("Smoother");
+    tc = tcase_create("smoother");
+    tcase_add_test(tc, smoother_test);
+    suite_add_tcase(s, tc);
+
+    sr = srunner_create(s);
+    srunner_run_all(sr, CK_NORMAL);
+    failed = srunner_ntests_failed(sr);
+    srunner_free(sr);
 
-    return 0;
+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }