diff options
author | Richard Hughes <richard@hughsie.com> | 2009-09-11 13:51:28 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2009-09-11 13:51:28 +0100 |
commit | 9785f18d7e8ba0c927b52fbfba0147a4afdaf28f (patch) | |
tree | f2192da4b3d2c3c63374a275dcdafc662b0d5d06 /src/dummy | |
parent | 8cb468ce64b0e1b21198744977d8a14e17ff5efe (diff) | |
download | upower-9785f18d7e8ba0c927b52fbfba0147a4afdaf28f.tar.gz |
Add some self tests and fix up some obvious bugs
Diffstat (limited to 'src/dummy')
-rw-r--r-- | src/dummy/.gitignore | 2 | ||||
-rw-r--r-- | src/dummy/Makefile.am | 3 | ||||
-rw-r--r-- | src/dummy/dkp-backend.c | 27 | ||||
-rw-r--r-- | src/dummy/dkp-native.c | 24 |
4 files changed, 54 insertions, 2 deletions
diff --git a/src/dummy/.gitignore b/src/dummy/.gitignore index ed89e2f..412ad37 100644 --- a/src/dummy/.gitignore +++ b/src/dummy/.gitignore @@ -2,4 +2,6 @@ .libs *.o *.a +*.lo +*.la diff --git a/src/dummy/Makefile.am b/src/dummy/Makefile.am index 804358a..25afad6 100644 --- a/src/dummy/Makefile.am +++ b/src/dummy/Makefile.am @@ -7,14 +7,13 @@ INCLUDES = \ -DEGG_LOGGING="\"DKP_LOGGING\"" \ -DEGG_CONSOLE="\"DKP_CONSOLE\"" \ -DDKP_COMPILATION \ + -DEGG_TEST \ -I$(top_srcdir)/devkit-power-gobject \ $(DBUS_GLIB_CFLAGS) \ $(POLKIT_CFLAGS) \ $(GLIB_CFLAGS) -if BACKEND_TYPE_DUMMY noinst_LTLIBRARIES = libdkpshared.la -endif libdkpshared_la_SOURCES = \ dkp-backend.c \ diff --git a/src/dummy/dkp-backend.c b/src/dummy/dkp-backend.c index 8db6277..1ffd508 100644 --- a/src/dummy/dkp-backend.c +++ b/src/dummy/dkp-backend.c @@ -219,3 +219,30 @@ dkp_backend_new (void) return DKP_BACKEND (backend); } +/*************************************************************************** + *** MAKE CHECK TESTS *** + ***************************************************************************/ +#ifdef EGG_TEST +#include "egg-test.h" + +void +dkp_backend_test (gpointer user_data) +{ + EggTest *test = (EggTest *) user_data; + DkpBackend *backend; + + if (!egg_test_start (test, "DkpBackend")) + return; + + /************************************************************/ + egg_test_title (test, "get instance"); + backend = dkp_backend_new (); + egg_test_assert (test, backend != NULL); + + /* unref */ + g_object_unref (backend); + + egg_test_end (test); +} +#endif + diff --git a/src/dummy/dkp-native.c b/src/dummy/dkp-native.c index 1dea65c..4388a41 100644 --- a/src/dummy/dkp-native.c +++ b/src/dummy/dkp-native.c @@ -38,3 +38,27 @@ dkp_native_get_native_path (GObject *object) return "/sys/dummy"; } +/*************************************************************************** + *** MAKE CHECK TESTS *** + ***************************************************************************/ +#ifdef EGG_TEST +#include "egg-test.h" + +void +dkp_native_test (gpointer user_data) +{ + EggTest *test = (EggTest *) user_data; + const gchar *path; + + if (!egg_test_start (test, "DkpNative")) + return; + + /************************************************************/ + egg_test_title (test, "get instance"); + path = dkp_native_get_native_path (NULL); + egg_test_assert (test, (g_strcmp0 (path, "/sys/dummy") == 0)); + + egg_test_end (test); +} +#endif + |