[dconf/wip/reorg: 486/498] tests/: convert path test to gtester



commit eb971e70889db9505676dde4ba4822fac8fdb3a8
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jul 5 23:49:22 2012 -0400

    tests/: convert path test to gtester

 tests/Makefile.am |    6 ++++--
 tests/paths.c     |   15 ++++++---------
 2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7e836d4..f166ef5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,11 +3,13 @@ include $(top_srcdir)/Makefile.gtester
 AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -DSRCDIR=\"$(abs_srcdir)\"
 INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client $(gio_CFLAGS) -I$(top_srcdir)/dbus-1 $(dbus_CFLAGS) -I$(top_srcdir)/gvdb
 
-noinst_PROGRAMS = $(TEST_PROGS) paths gsettings dbus1
+noinst_PROGRAMS = $(TEST_PROGS) gsettings dbus1
 
 gsettings_LDADD = $(gio_LIBS)
 dbus1_LDADD = -L../dbus-1 -ldconf-dbus-1 $(glib_LIBS)
-paths_LDADD = $(gio_LIBS) ../common/libdconf-common.a
+
+TEST_PROGS += paths
+paths_LDADD = ../common/libdconf-common.a $(gio_LIBS)
 paths_SOURCES = paths.c
 
 TEST_PROGS += gvdb
diff --git a/tests/paths.c b/tests/paths.c
index a95530e..143d3fa 100644
--- a/tests/paths.c
+++ b/tests/paths.c
@@ -82,19 +82,16 @@ test_paths (void)
               (dconf_is_rel_key (string, NULL) ? 020 : 000) |
               (dconf_is_rel_dir (string, NULL) ? 040 : 000);
 
-      if (flags != cases[i].flags)
-        {
-          g_print ("case %i: string '%s' should be %o but is %o",
-                   i, string, cases[i].flags, flags);
-          g_assert_not_reached ();
-        }
+      g_assert_cmphex (flags, ==, cases[i].flags);
     }
 }
 
 int
-main (void)
+main (int argc, char **argv)
 {
-  test_paths ();
+  g_test_init (&argc, &argv, NULL);
 
-  return 0;
+  g_test_add_func ("/paths", test_paths);
+
+  return g_test_run ();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]