gnome-power-manager r2918 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2918 - in trunk: . src
- Date: Thu, 4 Sep 2008 10:49:23 +0000 (UTC)
Author: rhughes
Date: Thu Sep 4 10:49:23 2008
New Revision: 2918
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2918&view=rev
Log:
2008-09-04 Richard Hughes <richard hughsie com>
* src/Makefile.am:
* src/egg-test.c: (egg_test_init), (egg_test_loop_quit),
(egg_test_hang_check), (egg_test_loop_wait), (egg_test_loop_check),
(egg_test_set_user_data), (egg_test_get_user_data),
(egg_test_finish), (egg_test_elapsed), (egg_test_start),
(egg_test_end), (egg_test_title), (egg_test_success),
(egg_test_failed), (egg_test_get_data_file):
* src/egg-test.h:
* src/gpm-array-float.c: (gpm_array_float_test):
* src/gpm-array.c: (gpm_array_test):
* src/gpm-cell-array.c: (gpm_cell_test_array):
* src/gpm-cell-unit.c: (gpm_cell_unit_test):
* src/gpm-cell.c: (gpm_cell_test):
* src/gpm-common.c: (gpm_common_test):
* src/gpm-graph-widget.c: (clicked_passed_cb), (clicked_failed_cb),
(create_graph_window), (wait_for_input), (egg_test_title_graph),
(gpm_graph_widget_test):
* src/gpm-inhibit.c: (gpm_inhibit_test):
* src/gpm-phone.c: (egg_test_mainloop_wait), (gpm_phone_test):
* src/gpm-profile.c: (gpm_profile_test):
* src/gpm-self-test.c: (main):
* src/gpm-self-test.h:
Use EggTest rather than the obsolete self-made function.
Added:
trunk/src/egg-test.c
trunk/src/egg-test.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gpm-array-float.c
trunk/src/gpm-array.c
trunk/src/gpm-cell-array.c
trunk/src/gpm-cell-unit.c
trunk/src/gpm-cell.c
trunk/src/gpm-common.c
trunk/src/gpm-graph-widget.c
trunk/src/gpm-inhibit.c
trunk/src/gpm-phone.c
trunk/src/gpm-profile.c
trunk/src/gpm-self-test.c
trunk/src/gpm-self-test.h
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu Sep 4 10:49:23 2008
@@ -238,8 +238,12 @@
endif
gnome_power_self_test_SOURCES = \
- egg-color.c \
egg-color.h \
+ egg-color.c \
+ egg-test.h \
+ egg-test.c \
+ egg-debug.h \
+ egg-debug.c \
gpm-ac-adapter.h \
gpm-ac-adapter.c \
gpm-prefs-server.h \
@@ -247,15 +251,12 @@
gpm-control.h \
gpm-control.c \
gpm-self-test.c \
- gpm-self-test.h \
gpm-networkmanager.h \
gpm-networkmanager.c \
gpm-dpms.h \
gpm-dpms.c \
gpm-button.h \
gpm-button.c \
- egg-debug.h \
- egg-debug.c \
gpm-notify.h \
gpm-notify.c \
gpm-screensaver.h \
@@ -310,8 +311,7 @@
$(GPM_EXTRA_LIBS) \
$(NULL)
-gnome_power_self_test_CPPFLAGS= \
- -DGPM_BUILD_TESTS
+gnome_power_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
BUILT_SOURCES = \
gpm-marshal.c \
Added: trunk/src/egg-test.c
==============================================================================
--- (empty file)
+++ trunk/src/egg-test.c Thu Sep 4 10:49:23 2008
@@ -0,0 +1,292 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+#include <string.h>
+#include <glib/gi18n.h>
+#include <glib-object.h>
+#include <glib/gprintf.h>
+
+#include "egg-test.h"
+
+struct EggTest {
+ guint total;
+ guint succeeded;
+ gboolean started;
+ gchar *type;
+ GTimer *timer;
+ GMainLoop *loop;
+ guint hang_loop_id;
+ gpointer user_data;
+};
+
+/**
+ * egg_test_init:
+ **/
+EggTest *
+egg_test_init ()
+{
+ EggTest *test;
+ test = g_new (EggTest, 1);
+ test->total = 0;
+ test->succeeded = 0;
+ test->type = NULL;
+ test->started = FALSE;
+ test->timer = g_timer_new ();
+ test->loop = g_main_loop_new (NULL, FALSE);
+ test->hang_loop_id = 0;
+ return test;
+}
+
+/**
+ * egg_test_loop_quit:
+ **/
+void
+egg_test_loop_quit (EggTest *test)
+{
+ /* disable the loop watch */
+ if (test->hang_loop_id != 0) {
+ g_source_remove (test->hang_loop_id);
+ test->hang_loop_id = 0;
+ }
+ g_main_loop_quit (test->loop);
+}
+
+/**
+ * egg_test_hang_check:
+ **/
+static gboolean
+egg_test_hang_check (gpointer data)
+{
+ EggTest *test = (EggTest *) data;
+ g_main_loop_quit (test->loop);
+ return FALSE;
+}
+
+/**
+ * egg_test_loop_wait:
+ **/
+void
+egg_test_loop_wait (EggTest *test, guint timeout)
+{
+ test->hang_loop_id = g_timeout_add (timeout, egg_test_hang_check, test);
+ g_main_loop_run (test->loop);
+}
+
+/**
+ * egg_test_loop_check:
+ **/
+void
+egg_test_loop_check (EggTest *test)
+{
+ guint elapsed = egg_test_elapsed (test);
+ egg_test_title (test, "did we timeout out of the loop");
+ if (test->hang_loop_id == 0) {
+ egg_test_success (test, "loop blocked for %ims", elapsed);
+ } else {
+ egg_test_failed (test, "hangcheck saved us after %ims", elapsed);
+ }
+}
+
+/**
+ * egg_test_set_user_data:
+ **/
+void
+egg_test_set_user_data (EggTest *test, gpointer user_data)
+{
+ test->user_data = user_data;
+}
+
+/**
+ * egg_test_get_user_data:
+ **/
+gpointer
+egg_test_get_user_data (EggTest *test)
+{
+ return test->user_data;
+}
+
+/**
+ * egg_test_finish:
+ **/
+gint
+egg_test_finish (EggTest *test)
+{
+ gint retval;
+ g_print ("test passes (%u/%u) : ", test->succeeded, test->total);
+ if (test->succeeded == test->total) {
+ g_print ("ALL OKAY\n");
+ retval = 0;
+ } else {
+ g_print ("%u FAILURE(S)\n", test->total - test->succeeded);
+ retval = 1;
+ }
+
+ g_timer_destroy (test->timer);
+ g_main_loop_unref (test->loop);
+ g_free (test);
+
+ return retval;
+}
+
+/**
+ * egg_test_elapsed:
+ *
+ * Returns: time in ms
+ **/
+guint
+egg_test_elapsed (EggTest *test)
+{
+ gdouble time;
+ time = g_timer_elapsed (test->timer, NULL);
+ return (guint) (time * 1000.0f);
+}
+
+/**
+ * egg_test_start:
+ **/
+gboolean
+egg_test_start (EggTest *test, const gchar *name)
+{
+ if (test->started == TRUE) {
+ g_print ("Not ended test! Cannot start!\n");
+ exit (1);
+ }
+ test->type = g_strdup (name);
+ test->started = TRUE;
+ g_print ("%s...", test->type);
+ return TRUE;
+}
+
+/**
+ * egg_test_end:
+ **/
+void
+egg_test_end (EggTest *test)
+{
+ if (test->started == FALSE) {
+ g_print ("Not started test! Cannot finish!\n");
+ exit (1);
+ }
+ g_print ("OK\n");
+
+ /* disable hang check */
+ if (test->hang_loop_id != 0) {
+ g_source_remove (test->hang_loop_id);
+ test->hang_loop_id = 0;
+ }
+
+ test->started = FALSE;
+ g_free (test->type);
+}
+
+/**
+ * egg_test_title:
+ **/
+void
+egg_test_title (EggTest *test, const gchar *format, ...)
+{
+ va_list args;
+ gchar *va_args_buffer = NULL;
+
+ /* reset the value egg_test_elapsed replies with */
+ g_timer_reset (test->timer);
+
+ va_start (args, format);
+ g_vasprintf (&va_args_buffer, format, args);
+ va_end (args);
+ g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
+ g_free(va_args_buffer);
+
+ test->total++;
+}
+
+/**
+ * egg_test_success:
+ **/
+void
+egg_test_success (EggTest *test, const gchar *format, ...)
+{
+ va_list args;
+ gchar *va_args_buffer = NULL;
+
+ if (format == NULL) {
+ g_print ("...OK\n");
+ goto finish;
+ }
+ va_start (args, format);
+ g_vasprintf (&va_args_buffer, format, args);
+ va_end (args);
+ g_print ("...OK [%s]\n", va_args_buffer);
+ g_free(va_args_buffer);
+finish:
+ test->succeeded++;
+}
+
+/**
+ * egg_test_failed:
+ **/
+void
+egg_test_failed (EggTest *test, const gchar *format, ...)
+{
+ va_list args;
+ gchar *va_args_buffer = NULL;
+ if (format == NULL) {
+ g_print ("FAILED\n");
+ goto failed;
+ }
+ va_start (args, format);
+ g_vasprintf (&va_args_buffer, format, args);
+ va_end (args);
+ g_print ("FAILED [%s]\n", va_args_buffer);
+ g_free(va_args_buffer);
+failed:
+ exit (1);
+}
+
+/**
+ * egg_test_get_data_file:
+ **/
+gchar *
+egg_test_get_data_file (const gchar *filename)
+{
+ gboolean ret;
+ gchar *full;
+
+ /* check to see if we are being run in the build root */
+ full = g_build_filename ("..", "data", "tests", filename, NULL);
+ ret = g_file_test (full, G_FILE_TEST_EXISTS);
+ if (ret) {
+ return full;
+ }
+ g_free (full);
+
+ /* check to see if we are being run in make check */
+ full = g_build_filename ("..", "..", "data", "tests", filename, NULL);
+ ret = g_file_test (full, G_FILE_TEST_EXISTS);
+ if (ret) {
+ return full;
+ }
+ g_free (full);
+ return NULL;
+}
+
Added: trunk/src/egg-test.h
==============================================================================
--- (empty file)
+++ trunk/src/egg-test.h Thu Sep 4 10:49:23 2008
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EGG_TEST_H
+#define __EGG_TEST_H
+
+#include <glib.h>
+#include <string.h>
+
+typedef struct EggTest EggTest;
+
+gboolean egg_test_start (EggTest *test, const gchar *name);
+void egg_test_end (EggTest *test);
+void egg_test_title (EggTest *test, const gchar *format, ...);
+void egg_test_success (EggTest *test, const gchar *format, ...);
+void egg_test_failed (EggTest *test, const gchar *format, ...);
+EggTest *egg_test_init (void);
+gint egg_test_finish (EggTest *test);
+guint egg_test_elapsed (EggTest *test);
+void egg_test_loop_quit (EggTest *test);
+void egg_test_loop_wait (EggTest *test, guint timeout);
+void egg_test_loop_check (EggTest *test);
+void egg_test_set_user_data (EggTest *test, gpointer user_data);
+gpointer egg_test_get_user_data (EggTest *test);
+gchar *egg_test_get_data_file (const gchar *filename);
+
+#endif /* __EGG_TEST_H */
+
Modified: trunk/src/gpm-array-float.c
==============================================================================
--- trunk/src/gpm-array-float.c (original)
+++ trunk/src/gpm-array-float.c Thu Sep 4 10:49:23 2008
@@ -379,11 +379,11 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
void
-gpm_st_array_float (GpmSelfTest *test)
+gpm_array_float_test (EggTest *test)
{
GArray *array;
GArray *kernel;
@@ -392,101 +392,101 @@
gfloat sigma;
guint size;
- if (gpm_st_start (test, "GpmArrayFloat") == FALSE) {
+ if (egg_test_start (test, "GpmArrayFloat") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null array");
+ egg_test_title (test, "make sure we get a non null array");
array = gpm_array_float_new (10);
if (array != NULL) {
- gpm_st_success (test, "got GArray");
+ egg_test_success (test, "got GArray");
} else {
- gpm_st_failed (test, "could not get GArray");
+ egg_test_failed (test, "could not get GArray");
}
gpm_array_float_print (array);
gpm_array_float_free (array);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct length array");
+ egg_test_title (test, "make sure we get the correct length array");
array = gpm_array_float_new (10);
if (array->len == 10) {
- gpm_st_success (test, "got correct size");
+ egg_test_success (test, "got correct size");
} else {
- gpm_st_failed (test, "got wrong size");
+ egg_test_failed (test, "got wrong size");
}
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum");
+ egg_test_title (test, "make sure we get the correct array sum");
value = gpm_array_float_sum (array);
if (value == 0.0) {
- gpm_st_success (test, "got correct sum");
+ egg_test_success (test, "got correct sum");
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
/************************************************************/
- gpm_st_title (test, "get gaussian 0.0, sigma 1.0");
+ egg_test_title (test, "get gaussian 0.0, sigma 1.0");
value = gpm_array_float_guassian_value (0.0, 1.0);
if (value - 0.398942 < 0.0001) {
- gpm_st_success (test, "got correct gaussian");
+ egg_test_success (test, "got correct gaussian");
} else {
- gpm_st_failed (test, "got wrong gaussian (%f)", value);
+ egg_test_failed (test, "got wrong gaussian (%f)", value);
}
/************************************************************/
- gpm_st_title (test, "get gaussian 1.0, sigma 1.0");
+ egg_test_title (test, "get gaussian 1.0, sigma 1.0");
value = gpm_array_float_guassian_value (1.0, 1.0);
if (value - 0.241971 < 0.0001) {
- gpm_st_success (test, "got correct gaussian");
+ egg_test_success (test, "got correct gaussian");
} else {
- gpm_st_failed (test, "got wrong gaussian (%f)", value);
+ egg_test_failed (test, "got wrong gaussian (%f)", value);
}
/************************************************************/
size = 9;
sigma = 1.1;
- gpm_st_title (test, "get gaussian array (%i), sigma %f", size, sigma);
+ egg_test_title (test, "get gaussian array (%i), sigma %f", size, sigma);
kernel = gpm_array_float_compute_gaussian (size, sigma);
if (kernel != NULL && kernel->len == size) {
- gpm_st_success (test, "got correct length gaussian array");
+ egg_test_success (test, "got correct length gaussian array");
} else {
- gpm_st_failed (test, "got gaussian array length (%i)", array->len);
+ egg_test_failed (test, "got gaussian array length (%i)", array->len);
}
/************************************************************/
- gpm_st_title (test, "make sure we get an accurate gaussian");
+ egg_test_title (test, "make sure we get an accurate gaussian");
value = gpm_array_float_sum (kernel);
if (fabs(value - 1.0) < 0.01) {
- gpm_st_success (test, "got sum (%f)", value);
+ egg_test_success (test, "got sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
gpm_array_float_print (kernel);
/************************************************************/
- gpm_st_title (test, "make sure we get get and set");
+ egg_test_title (test, "make sure we get get and set");
gpm_array_float_set (array, 4, 100.0);
value = gpm_array_float_get (array, 4);
if (value == 100.0) {
- gpm_st_success (test, "got value okay", value);
+ egg_test_success (test, "got value okay", value);
} else {
- gpm_st_failed (test, "got wrong value (%f)", value);
+ egg_test_failed (test, "got wrong value (%f)", value);
}
gpm_array_float_print (array);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum (2)");
+ egg_test_title (test, "make sure we get the correct array sum (2)");
value = gpm_array_float_sum (array);
if (value == 100.0) {
- gpm_st_success (test, "got correct sum");
+ egg_test_success (test, "got correct sum");
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
/************************************************************/
- gpm_st_title (test, "test convolving with kernel #1");
+ egg_test_title (test, "test convolving with kernel #1");
gpm_array_float_set (array, 0, 0.0);
gpm_array_float_set (array, 1, 0.0);
gpm_array_float_set (array, 2, 0.0);
@@ -499,24 +499,24 @@
gpm_array_float_set (array, 9, 0.0);
result = gpm_array_float_convolve (array, kernel);
if (result->len == 10) {
- gpm_st_success (test, "got correct size convolve product");
+ egg_test_success (test, "got correct size convolve product");
} else {
- gpm_st_failed (test, "got correct size convolve product (%f)", result->len);
+ egg_test_failed (test, "got correct size convolve product (%f)", result->len);
}
gpm_array_float_print (result);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum of convolve #1");
+ egg_test_title (test, "make sure we get the correct array sum of convolve #1");
value = gpm_array_float_sum (result);
if (fabs(value - 100.0) < 5.0) {
- gpm_st_success (test, "got correct (enough) sum (%f)", value);
+ egg_test_success (test, "got correct (enough) sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
gpm_array_float_free (result);
/************************************************************/
- gpm_st_title (test, "test convolving with kernel #2");
+ egg_test_title (test, "test convolving with kernel #2");
gpm_array_float_set (array, 0, 100.0);
gpm_array_float_set (array, 1, 0.0);
gpm_array_float_set (array, 2, 0.0);
@@ -529,26 +529,26 @@
gpm_array_float_set (array, 9, 0.0);
result = gpm_array_float_convolve (array, kernel);
if (result->len == 10) {
- gpm_st_success (test, "got correct size convolve product");
+ egg_test_success (test, "got correct size convolve product");
} else {
- gpm_st_failed (test, "got correct size convolve product (%f)", result->len);
+ egg_test_failed (test, "got correct size convolve product (%f)", result->len);
}
gpm_array_float_print (array);
gpm_array_float_print (result);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum of convolve #2");
+ egg_test_title (test, "make sure we get the correct array sum of convolve #2");
value = gpm_array_float_sum (result);
if (fabs(value - 100.0) < 10.0) {
- gpm_st_success (test, "got correct (enough) sum (%f)", value);
+ egg_test_success (test, "got correct (enough) sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
gpm_array_float_free (result);
/************************************************************/
- gpm_st_title (test, "test convolving with kernel #3");
+ egg_test_title (test, "test convolving with kernel #3");
gpm_array_float_set (array, 0, 0.0);
gpm_array_float_set (array, 1, 0.0);
gpm_array_float_set (array, 2, 0.0);
@@ -561,25 +561,25 @@
gpm_array_float_set (array, 9, 100.0);
result = gpm_array_float_convolve (array, kernel);
if (result->len == 10) {
- gpm_st_success (test, "got correct size convolve product");
+ egg_test_success (test, "got correct size convolve product");
} else {
- gpm_st_failed (test, "got correct size convolve product (%f)", result->len);
+ egg_test_failed (test, "got correct size convolve product (%f)", result->len);
}
gpm_array_float_print (array);
gpm_array_float_print (result);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum of convolve #3");
+ egg_test_title (test, "make sure we get the correct array sum of convolve #3");
value = gpm_array_float_sum (result);
if (fabs(value - 100.0) < 10.0) {
- gpm_st_success (test, "got correct (enough) sum (%f)", value);
+ egg_test_success (test, "got correct (enough) sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
gpm_array_float_free (result);
/************************************************************/
- gpm_st_title (test, "test convolving with kernel #4");
+ egg_test_title (test, "test convolving with kernel #4");
gpm_array_float_set (array, 0, 10.0);
gpm_array_float_set (array, 1, 10.0);
gpm_array_float_set (array, 2, 10.0);
@@ -592,24 +592,24 @@
gpm_array_float_set (array, 9, 10.0);
result = gpm_array_float_convolve (array, kernel);
if (result->len == 10) {
- gpm_st_success (test, "got correct size convolve product");
+ egg_test_success (test, "got correct size convolve product");
} else {
- gpm_st_failed (test, "got incorrect size convolve product (%f)", result->len);
+ egg_test_failed (test, "got incorrect size convolve product (%f)", result->len);
}
gpm_array_float_print (array);
gpm_array_float_print (result);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum of convolve #4");
+ egg_test_title (test, "make sure we get the correct array sum of convolve #4");
value = gpm_array_float_sum (result);
if (fabs(value - 100.0) < 1.0) {
- gpm_st_success (test, "got correct (enough) sum (%f)", value);
+ egg_test_success (test, "got correct (enough) sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
/************************************************************/
- gpm_st_title (test, "test convolving with kernel #5");
+ egg_test_title (test, "test convolving with kernel #5");
gpm_array_float_set (array, 0, 10.0);
gpm_array_float_set (array, 1, 10.0);
gpm_array_float_set (array, 2, 10.0);
@@ -622,24 +622,24 @@
gpm_array_float_set (array, 9, 10.0);
result = gpm_array_float_convolve (array, kernel);
if (result->len == 10) {
- gpm_st_success (test, "got correct size convolve product");
+ egg_test_success (test, "got correct size convolve product");
} else {
- gpm_st_failed (test, "got incorrect size convolve product (%f)", result->len);
+ egg_test_failed (test, "got incorrect size convolve product (%f)", result->len);
}
gpm_array_float_print (array);
gpm_array_float_print (result);
/************************************************************/
- gpm_st_title (test, "make sure we get the correct array sum of convolve #5");
+ egg_test_title (test, "make sure we get the correct array sum of convolve #5");
value = gpm_array_float_sum (result);
if (fabs(value - 90.0) < 1.0) {
- gpm_st_success (test, "got correct (enough) sum (%f)", value);
+ egg_test_success (test, "got correct (enough) sum (%f)", value);
} else {
- gpm_st_failed (test, "got wrong sum (%f)", value);
+ egg_test_failed (test, "got wrong sum (%f)", value);
}
/*************** INTEGRATION TEST ************************/
- gpm_st_title (test, "integration down");
+ egg_test_title (test, "integration down");
gpm_array_float_set (array, 0, 0.0);
gpm_array_float_set (array, 1, 1.0);
gpm_array_float_set (array, 2, 2.0);
@@ -652,27 +652,27 @@
gpm_array_float_set (array, 9, 9.0);
size = gpm_array_float_compute_integral (array, 0, 4);
if (size == 0+1+2+3+4) {
- gpm_st_success (test, "intergrated okay");
+ egg_test_success (test, "intergrated okay");
} else {
- gpm_st_failed (test, "did not intergrated okay (%i)", size);
+ egg_test_failed (test, "did not intergrated okay (%i)", size);
}
- gpm_st_title (test, "integration up");
+ egg_test_title (test, "integration up");
size = gpm_array_float_compute_integral (array, 5, 9);
if (size == 5+6+7+8+9) {
- gpm_st_success (test, "intergrated okay");
+ egg_test_success (test, "intergrated okay");
} else {
- gpm_st_failed (test, "did not intergrated okay (%i)", size);
+ egg_test_failed (test, "did not intergrated okay (%i)", size);
}
- gpm_st_title (test, "integration all");
+ egg_test_title (test, "integration all");
size = gpm_array_float_compute_integral (array, 0, 9);
if (size == 0+1+2+3+4+5+6+7+8+9) {
- gpm_st_success (test, "intergrated okay");
+ egg_test_success (test, "intergrated okay");
} else {
- gpm_st_failed (test, "did not intergrated okay (%i)", size);
+ egg_test_failed (test, "did not intergrated okay (%i)", size);
}
/*************** AVERAGE TEST ************************/
- gpm_st_title (test, "average");
+ egg_test_title (test, "average");
gpm_array_float_set (array, 0, 0.0);
gpm_array_float_set (array, 1, 1.0);
gpm_array_float_set (array, 2, 2.0);
@@ -685,16 +685,16 @@
gpm_array_float_set (array, 9, 9.0);
value = gpm_array_float_get_average (array);
if (value == 4.5) {
- gpm_st_success (test, "averaged okay");
+ egg_test_success (test, "averaged okay");
} else {
- gpm_st_failed (test, "did not average okay (%i)", value);
+ egg_test_failed (test, "did not average okay (%i)", value);
}
gpm_array_float_free (result);
gpm_array_float_free (array);
gpm_array_float_free (kernel);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-array.c
==============================================================================
--- trunk/src/gpm-array.c (original)
+++ trunk/src/gpm-array.c Thu Sep 4 10:49:23 2008
@@ -922,11 +922,11 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
void
-gpm_st_array (GpmSelfTest *test)
+gpm_array_test (EggTest *test)
{
GpmArray *array;
GpmArray *array2;
@@ -937,157 +937,157 @@
gint svalue;
guint i;
- if (gpm_st_start (test, "GpmArray") == FALSE) {
+ if (egg_test_start (test, "GpmArray") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null array");
+ egg_test_title (test, "make sure we get a non null array");
array = gpm_array_new ();
if (array != NULL) {
- gpm_st_success (test, "got GpmArray");
+ egg_test_success (test, "got GpmArray");
} else {
- gpm_st_failed (test, "could not get GpmArray");
+ egg_test_failed (test, "could not get GpmArray");
}
/************** FIXED SIZE TESTS ****************************/
- gpm_st_title (test, "set fixed size of 10");
+ egg_test_title (test, "set fixed size of 10");
ret = gpm_array_set_fixed_size (array, 10);
if (ret) {
- gpm_st_success (test, "set size");
+ egg_test_success (test, "set size");
} else {
- gpm_st_failed (test, "set size failed");
+ egg_test_failed (test, "set size failed");
}
/************************************************************/
- gpm_st_title (test, "get fixed size");
+ egg_test_title (test, "get fixed size");
size = gpm_array_get_size (array);
if (size == 10) {
- gpm_st_success (test, "get size passed");
+ egg_test_success (test, "get size passed");
} else {
- gpm_st_failed (test, "get size failed");
+ egg_test_failed (test, "get size failed");
}
/************************************************************/
- gpm_st_title (test, "add some data (should fail as fixed size)");
+ egg_test_title (test, "add some data (should fail as fixed size)");
ret = gpm_array_add (array, 1, 2, 3);
if (!ret) {
- gpm_st_success (test, "could not append to fixed size");
+ egg_test_success (test, "could not append to fixed size");
} else {
- gpm_st_failed (test, "appended to fixed size array");
+ egg_test_failed (test, "appended to fixed size array");
}
/************************************************************/
- gpm_st_title (test, "get valid element (should be zero)");
+ egg_test_title (test, "get valid element (should be zero)");
point = gpm_array_get (array, 0);
if (point != NULL && point->x == 0 && point->y == 0 && point->data == 0) {
- gpm_st_success (test, "got blank data");
+ egg_test_success (test, "got blank data");
} else {
- gpm_st_failed (test, "did not get blank data");
+ egg_test_failed (test, "did not get blank data");
}
/************************************************************/
- gpm_st_title (test, "get out of range element (should fail)");
+ egg_test_title (test, "get out of range element (should fail)");
point = gpm_array_get (array, 10);
if (point == NULL) {
- gpm_st_success (test, "got NULL as OOB");
+ egg_test_success (test, "got NULL as OOB");
} else {
- gpm_st_failed (test, "did not NULL for OOB");
+ egg_test_failed (test, "did not NULL for OOB");
}
g_object_unref (array);
array = gpm_array_new ();
/************* VARIABLE SIZED TESTS *************************/
- gpm_st_title (test, "add some data (should pass as variable size)");
+ egg_test_title (test, "add some data (should pass as variable size)");
ret = gpm_array_add (array, 1, 2, 3);
if (ret) {
- gpm_st_success (test, "appended to variable size");
+ egg_test_success (test, "appended to variable size");
} else {
- gpm_st_failed (test, "did not append to variable size array");
+ egg_test_failed (test, "did not append to variable size array");
}
/************************************************************/
- gpm_st_title (test, "get variable size");
+ egg_test_title (test, "get variable size");
size = gpm_array_get_size (array);
if (size == 1) {
- gpm_st_success (test, "get size passed");
+ egg_test_success (test, "get size passed");
} else {
- gpm_st_failed (test, "get size failed");
+ egg_test_failed (test, "get size failed");
}
/************************************************************/
- gpm_st_title (test, "get out of range element (should fail)");
+ egg_test_title (test, "get out of range element (should fail)");
point = gpm_array_get (array, 1);
if (point == NULL) {
- gpm_st_success (test, "got NULL as OOB");
+ egg_test_success (test, "got NULL as OOB");
} else {
- gpm_st_failed (test, "did not NULL for OOB");
+ egg_test_failed (test, "did not NULL for OOB");
}
/************************************************************/
- gpm_st_title (test, "clear array");
+ egg_test_title (test, "clear array");
ret = gpm_array_clear (array);
if (ret) {
- gpm_st_success (test, "cleared");
+ egg_test_success (test, "cleared");
} else {
- gpm_st_failed (test, "did not clear");
+ egg_test_failed (test, "did not clear");
}
/************************************************************/
- gpm_st_title (test, "get cleared size");
+ egg_test_title (test, "get cleared size");
size = gpm_array_get_size (array);
if (size == 0) {
- gpm_st_success (test, "get size passed");
+ egg_test_success (test, "get size passed");
} else {
- gpm_st_failed (test, "get size failed");
+ egg_test_failed (test, "get size failed");
}
/************************************************************/
- gpm_st_title (test, "save to disk");
+ egg_test_title (test, "save to disk");
for (i=0;i<100;i++) {
gpm_array_add (array, i, i, i);
}
ret = gpm_array_save_to_file (array, "/tmp/gpm-self-test.txt");
if (ret) {
- gpm_st_success (test, "saved to disk");
+ egg_test_success (test, "saved to disk");
} else {
- gpm_st_failed (test, "could not save to disk");
+ egg_test_failed (test, "could not save to disk");
}
/************************************************************/
- gpm_st_title (test, "load from disk");
+ egg_test_title (test, "load from disk");
gpm_array_clear (array);
ret = gpm_array_append_from_file (array, "/tmp/gpm-self-test.txt");
if (ret) {
- gpm_st_success (test, "loaded from disk");
+ egg_test_success (test, "loaded from disk");
} else {
- gpm_st_failed (test, "could not load from disk");
+ egg_test_failed (test, "could not load from disk");
}
/************************************************************/
- gpm_st_title (test, "get file appended size");
+ egg_test_title (test, "get file appended size");
size = gpm_array_get_size (array);
if (size == 100) {
- gpm_st_success (test, "get size passed");
+ egg_test_success (test, "get size passed");
} else {
- gpm_st_failed (test, "get size failed: %i", size);
+ egg_test_failed (test, "get size failed: %i", size);
}
/************************************************************/
- gpm_st_title (test, "interpolate data");
+ egg_test_title (test, "interpolate data");
gpm_array_clear (array);
gpm_array_add (array, 1, 2, 0);
gpm_array_add (array, 3, 9, 0);
svalue = gpm_array_interpolate (array, 2);
if (svalue == 6) {
- gpm_st_success (test, "interpolated");
+ egg_test_success (test, "interpolated");
} else {
- gpm_st_failed (test, "interpolated incorrect: %i", svalue);
+ egg_test_failed (test, "interpolated incorrect: %i", svalue);
}
/************************************************************/
- gpm_st_title (test, "limit x size");
+ egg_test_title (test, "limit x size");
gpm_array_clear (array);
for (i=0;i<100;i++) {
gpm_array_add (array, i, i, i);
@@ -1095,13 +1095,13 @@
gpm_array_limit_x_size (array, 10);
size = gpm_array_get_size (array);
if (size == 10) {
- gpm_st_success (test, "limited size X");
+ egg_test_success (test, "limited size X");
} else {
- gpm_st_failed (test, "did not limit size X, size: %i", size);
+ egg_test_failed (test, "did not limit size X, size: %i", size);
}
/************************************************************/
- gpm_st_title (test, "limit x width");
+ egg_test_title (test, "limit x width");
gpm_array_clear (array);
for (i=0;i<100;i++) {
gpm_array_add (array, i, i, i);
@@ -1109,14 +1109,14 @@
gpm_array_limit_x_width (array, 10);
size = gpm_array_get_size (array);
if (size == 11) {
- gpm_st_success (test, "limited width X");
+ egg_test_success (test, "limited width X");
} else {
- gpm_st_failed (test, "did not limit width X, size: %i", size);
+ egg_test_failed (test, "did not limit width X, size: %i", size);
}
gpm_array_print (array);
/*************** COPY TEST **********************************/
- gpm_st_title (test, "test copy");
+ egg_test_title (test, "test copy");
array2 = gpm_array_new ();
gpm_array_clear (array);
gpm_array_set_fixed_size (array, 10);
@@ -1130,9 +1130,9 @@
y = gpm_array_get(array2,9)->y;
data = gpm_array_get(array2,5)->data;
if (size == 10 && x == 2 && y == 2 && gpm_array_get(array2,5)->data == 2) {
- gpm_st_success (test, "limited width X");
+ egg_test_success (test, "limited width X");
} else {
- gpm_st_failed (test, "did not limit width X, size: %i (%i,%i,%i)", size, x, y, data);
+ egg_test_failed (test, "did not limit width X, size: %i (%i,%i,%i)", size, x, y, data);
}
/************************************************************/
@@ -1140,7 +1140,7 @@
g_object_unref (array);
g_object_unref (array2);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c (original)
+++ trunk/src/gpm-cell-array.c Thu Sep 4 10:49:23 2008
@@ -1482,8 +1482,8 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
guint recall_count2 = 0;
@@ -1494,7 +1494,7 @@
}
void
-gpm_st_cell_array (GpmSelfTest *test)
+gpm_cell_test_array (EggTest *test)
{
GpmCell *cell;
GpmCellArray *cell_array;
@@ -1503,74 +1503,74 @@
gboolean ret;
guint count;
- if (gpm_st_start (test, "GpmCellArray") == FALSE) {
+ if (egg_test_start (test, "GpmCellArray") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null cell array");
+ egg_test_title (test, "make sure we get a non null cell array");
cell_array = gpm_cell_array_new ();
g_signal_connect (cell_array, "perhaps-recall",
G_CALLBACK (gpm_cell_array_perhaps_recall_cb), NULL);
if (cell_array != NULL) {
- gpm_st_success (test, "got GpmCellArray");
+ egg_test_success (test, "got GpmCellArray");
} else {
- gpm_st_failed (test, "could not get GpmCellArray");
+ egg_test_failed (test, "could not get GpmCellArray");
}
/************************************************************/
- gpm_st_title (test, "make sure we get set type");
+ egg_test_title (test, "make sure we get set type");
ret = gpm_cell_array_set_type (cell_array, GPM_CELL_UNIT_KIND_PRIMARY);
if (ret) {
- gpm_st_success (test, "set type");
+ egg_test_success (test, "set type");
} else {
- gpm_st_failed (test, "could not set type");
+ egg_test_failed (test, "could not set type");
}
/************************************************************/
- gpm_st_title (test, "make sure we got a single recall notice");
+ egg_test_title (test, "make sure we got a single recall notice");
if (recall_count2 == 0) {
- gpm_st_warning (test, "did not get recall - install fdi!");
+ egg_test_success (test, "did not get recall - install fdi!");
goto out;
}
if (recall_count2 == 1) {
- gpm_st_success (test, "got recall");
+ egg_test_success (test, "got recall");
} else {
- gpm_st_failed (test, "got duplicate recall");
+ egg_test_failed (test, "got duplicate recall");
}
/************************************************************/
- gpm_st_title (test, "make sure we got at least 1 cell");
+ egg_test_title (test, "make sure we got at least 1 cell");
count = gpm_cell_array_get_num_cells (cell_array);
if (count >= 1) {
- gpm_st_success (test, "got %d cell(s)", count);
+ egg_test_success (test, "got %d cell(s)", count);
} else {
- gpm_st_failed (test, "got %i cells", count);
+ egg_test_failed (test, "got %i cells", count);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a full description for cell array");
+ egg_test_title (test, "make sure we get a full description for cell array");
desc = gpm_cell_array_get_description (cell_array);
if (desc != NULL) {
- gpm_st_success (test, "got description %s", desc);
+ egg_test_success (test, "got description %s", desc);
g_free (desc);
} else {
- gpm_st_failed (test, "could not get description");
+ egg_test_failed (test, "could not get description");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a valid cell");
+ egg_test_title (test, "make sure we get a valid cell");
cell = gpm_cell_array_get_cell (cell_array, 0);
if (cell != NULL) {
- gpm_st_success (test, "got correct cell");
+ egg_test_success (test, "got correct cell");
} else {
- gpm_st_failed (test, "could not get correct cell");
+ egg_test_failed (test, "could not get correct cell");
}
out:
g_object_unref (cell_array);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-cell-unit.c
==============================================================================
--- trunk/src/gpm-cell-unit.c (original)
+++ trunk/src/gpm-cell-unit.c Thu Sep 4 10:49:23 2008
@@ -342,11 +342,11 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
void
-gpm_st_cell_unit (GpmSelfTest *test)
+gpm_cell_unit_test (EggTest *test)
{
GpmCellUnit unit_d;
GpmCellUnit *unit = &unit_d;
@@ -354,144 +354,144 @@
const gchar *cvalue;
gboolean ret;
- if (gpm_st_start (test, "GpmCellUnit") == FALSE) {
+ if (egg_test_start (test, "GpmCellUnit") == FALSE) {
return;
}
gpm_cell_unit_init (unit);
/************************************************************/
- gpm_st_title (test, "make sure hal type set correct");
+ egg_test_title (test, "make sure hal type set correct");
gpm_cell_unit_set_kind (unit, "primary");
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
- gpm_st_success (test, "type correct");
+ egg_test_success (test, "type correct");
} else {
- gpm_st_failed (test, "type incorrect");
+ egg_test_failed (test, "type incorrect");
}
/************************************************************/
- gpm_st_title (test, "make sure full battery isn't charged");
+ egg_test_title (test, "make sure full battery isn't charged");
unit->percentage = 100.0f;
unit->is_charging = FALSE;
unit->is_discharging = TRUE;
ret = gpm_cell_unit_is_charged (unit);
if (!ret) {
- gpm_st_success (test, "not charged");
+ egg_test_success (test, "not charged");
} else {
- gpm_st_failed (test, "declaring charged");
+ egg_test_failed (test, "declaring charged");
}
/************************************************************/
- gpm_st_title (test, "make sure string type is okay");
+ egg_test_title (test, "make sure string type is okay");
cvalue = gpm_cell_unit_get_kind_string (unit);
if (strcmp (cvalue, "primary") == 0) {
- gpm_st_success (test, "string type okay");
+ egg_test_success (test, "string type okay");
} else {
- gpm_st_failed (test, "string type not okay: %s", cvalue);
+ egg_test_failed (test, "string type not okay: %s", cvalue);
}
/************************************************************/
- gpm_st_title (test, "make sure single localised type is okay");
+ egg_test_title (test, "make sure single localised type is okay");
cvalue = gpm_cell_unit_get_kind_localised (unit, FALSE);
if (strcmp (cvalue, "Laptop battery") == 0) {
- gpm_st_success (test, "localised type okay");
+ egg_test_success (test, "localised type okay");
} else {
- gpm_st_failed (test, "localised type not okay: %s", cvalue);
+ egg_test_failed (test, "localised type not okay: %s", cvalue);
}
/************************************************************/
- gpm_st_title (test, "make sure plural localised type is okay");
+ egg_test_title (test, "make sure plural localised type is okay");
cvalue = gpm_cell_unit_get_kind_localised (unit, TRUE);
if (strcmp (cvalue, "Laptop batteries") == 0) {
- gpm_st_success (test, "localised type okay");
+ egg_test_success (test, "localised type okay");
} else {
- gpm_st_failed (test, "localised type not okay: %s", cvalue);
+ egg_test_failed (test, "localised type not okay: %s", cvalue);
}
/************************************************************/
- gpm_st_title (test, "make sure charging battery isn't charged");
+ egg_test_title (test, "make sure charging battery isn't charged");
unit->percentage = 99.0f;
unit->is_charging = TRUE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
if (!ret) {
- gpm_st_success (test, "not charged");
+ egg_test_success (test, "not charged");
} else {
- gpm_st_failed (test, "declaring charged");
+ egg_test_failed (test, "declaring charged");
}
/************************************************************/
- gpm_st_title (test, "make sure full battery is charged");
+ egg_test_title (test, "make sure full battery is charged");
unit->percentage = 95.0f;
unit->is_charging = FALSE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
if (ret) {
- gpm_st_success (test, "charged");
+ egg_test_success (test, "charged");
} else {
- gpm_st_failed (test, "declaring non-charged");
+ egg_test_failed (test, "declaring non-charged");
}
/************************************************************/
- gpm_st_title (test, "make sure broken battery isn't charged");
+ egg_test_title (test, "make sure broken battery isn't charged");
unit->percentage = 30.0f;
unit->is_charging = FALSE;
unit->is_discharging = FALSE;
ret = gpm_cell_unit_is_charged (unit);
if (!ret) {
- gpm_st_success (test, "not charged");
+ egg_test_success (test, "not charged");
} else {
- gpm_st_failed (test, "declaring charged");
+ egg_test_failed (test, "declaring charged");
}
/************************************************************/
- gpm_st_title (test, "get missing icon");
+ egg_test_title (test, "get missing icon");
unit->percentage = 30.0f;
unit->is_present = FALSE;
value = gpm_cell_unit_get_icon (unit);
if (strcmp (value, "gpm-primary-missing") == 0) {
- gpm_st_success (test, "icon correct");
+ egg_test_success (test, "icon correct");
} else {
- gpm_st_failed (test, "icon not correct: %s", value);
+ egg_test_failed (test, "icon not correct: %s", value);
}
g_free (value);
/************************************************************/
- gpm_st_title (test, "get middle icon");
+ egg_test_title (test, "get middle icon");
unit->percentage = 30.0f;
unit->is_present = TRUE;
value = gpm_cell_unit_get_icon (unit);
if (strcmp (value, "gpm-primary-040") == 0) {
- gpm_st_success (test, "icon correct");
+ egg_test_success (test, "icon correct");
} else {
- gpm_st_failed (test, "icon not correct: %s", value);
+ egg_test_failed (test, "icon not correct: %s", value);
}
g_free (value);
/************************************************************/
- gpm_st_title (test, "get charged icon");
+ egg_test_title (test, "get charged icon");
unit->is_charging = FALSE;
unit->is_discharging = FALSE;
unit->percentage = 95.0f;
unit->is_present = TRUE;
value = gpm_cell_unit_get_icon (unit);
if (strcmp (value, "gpm-primary-charged") == 0) {
- gpm_st_success (test, "icon correct");
+ egg_test_success (test, "icon correct");
} else {
- gpm_st_failed (test, "icon not correct: %s", value);
+ egg_test_failed (test, "icon not correct: %s", value);
}
g_free (value);
/************************************************************/
- gpm_st_title (test, "setting measure");
+ egg_test_title (test, "setting measure");
gpm_cell_unit_set_measure (unit);
if (unit->measure == GPM_CELL_UNIT_MWH) {
- gpm_st_success (test, "measure correct");
+ egg_test_success (test, "measure correct");
} else {
- gpm_st_failed (test, "measre not correct: %s", unit->measure);
+ egg_test_failed (test, "measre not correct: %s", unit->measure);
}
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-cell.c
==============================================================================
--- trunk/src/gpm-cell.c (original)
+++ trunk/src/gpm-cell.c Thu Sep 4 10:49:23 2008
@@ -810,8 +810,8 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
#include <libhal-gmanager.h>
guint recall_count = 0;
@@ -843,7 +843,7 @@
void
-gpm_st_cell (GpmSelfTest *test)
+gpm_cell_test (EggTest *test)
{
GpmCell *cell;
GpmCellUnit *unit;
@@ -851,97 +851,97 @@
gboolean ret;
gchar *udi;
- if (gpm_st_start (test, "GpmCell") == FALSE) {
+ if (egg_test_start (test, "GpmCell") == FALSE) {
return;
}
/* get battery */
udi = gpm_cell_get_battery ();
if (udi == NULL) {
- gpm_st_failed (test, "did not find battery device");
- gpm_st_end (test);
+ egg_test_failed (test, "did not find battery device");
+ egg_test_end (test);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null cell");
+ egg_test_title (test, "make sure we get a non null cell");
cell = gpm_cell_new ();
g_signal_connect (cell, "perhaps-recall",
G_CALLBACK (gpm_cell_perhaps_recall_cb), NULL);
if (cell != NULL) {
- gpm_st_success (test, "got GpmCell");
+ egg_test_success (test, "got GpmCell");
} else {
- gpm_st_failed (test, "could not get GpmCell");
+ egg_test_failed (test, "could not get GpmCell");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null unit");
+ egg_test_title (test, "make sure we get a non null unit");
unit = gpm_cell_get_unit (cell);
if (unit != NULL) {
- gpm_st_success (test, "got GpmCellUnit");
+ egg_test_success (test, "got GpmCellUnit");
} else {
- gpm_st_failed (test, "could not get GpmCellUnit");
+ egg_test_failed (test, "could not get GpmCellUnit");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a null description for nonassigned cell");
+ egg_test_title (test, "make sure we get a null description for nonassigned cell");
desc = gpm_cell_get_description (cell);
if (desc != NULL) {
- gpm_st_success (test, "got description %s", desc);
+ egg_test_success (test, "got description %s", desc);
g_free (desc);
} else {
- gpm_st_failed (test, "could not get description");
+ egg_test_failed (test, "could not get description");
}
/************************************************************/
- gpm_st_title (test, "can we assign device");
+ egg_test_title (test, "can we assign device");
ret = gpm_cell_set_device_id (cell, udi);
if (ret) {
- gpm_st_success (test, "set type okay");
+ egg_test_success (test, "set type okay");
} else {
- gpm_st_failed (test, "could not set type");
+ egg_test_failed (test, "could not set type");
}
/************************************************************/
- gpm_st_title (test, "make sure we got a single recall notice");
+ egg_test_title (test, "make sure we got a single recall notice");
if (recall_count == 1) {
- gpm_st_success (test, "got recall");
+ egg_test_success (test, "got recall");
} else {
- gpm_st_failed (test, "did not get recall (install fdi?)");
+ egg_test_failed (test, "did not get recall (install fdi?)");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a full description for set cell");
+ egg_test_title (test, "make sure we get a full description for set cell");
desc = gpm_cell_get_description (cell);
if (desc != NULL) {
- gpm_st_success (test, "got description %s", desc);
+ egg_test_success (test, "got description %s", desc);
g_free (desc);
} else {
- gpm_st_failed (test, "could not get description");
+ egg_test_failed (test, "could not get description");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a valid unit");
+ egg_test_title (test, "make sure we get a valid unit");
unit = gpm_cell_get_unit (cell);
if (unit->voltage > 1000 && unit->voltage < 20000) {
- gpm_st_success (test, "got correct voltage");
+ egg_test_success (test, "got correct voltage");
} else {
- gpm_st_failed (test, "could not get correct voltage %i", unit->voltage);
+ egg_test_failed (test, "could not get correct voltage %i", unit->voltage);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a id");
+ egg_test_title (test, "make sure we get a id");
desc = gpm_cell_get_id (cell);
if (desc != NULL) {
- gpm_st_success (test, "got valid id %s", desc);
+ egg_test_success (test, "got valid id %s", desc);
} else {
- gpm_st_failed (test, "could not get valid id");
+ egg_test_failed (test, "could not get valid id");
}
g_free (udi);
g_free (desc);
g_object_unref (cell);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-common.c
==============================================================================
--- trunk/src/gpm-common.c (original)
+++ trunk/src/gpm-common.c Thu Sep 4 10:49:23 2008
@@ -336,155 +336,155 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
void
-gpm_st_common (GpmSelfTest *test)
+gpm_common_test (EggTest *test)
{
guint value;
gfloat fvalue;
- if (gpm_st_start (test, "GpmCommon") == FALSE) {
+ if (egg_test_start (test, "GpmCommon") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "limit precision down 0,10");
+ egg_test_title (test, "limit precision down 0,10");
value = gpm_precision_round_down (0, 10);
if (value == 0) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision down 4,10");
+ egg_test_title (test, "limit precision down 4,10");
value = gpm_precision_round_down (4, 10);
if (value == 0) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision down 11,10");
+ egg_test_title (test, "limit precision down 11,10");
value = gpm_precision_round_down (11, 10);
if (value == 10) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision down 201,2");
+ egg_test_title (test, "limit precision down 201,2");
value = gpm_precision_round_down (201, 2);
if (value == 200) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision down 100,10");
+ egg_test_title (test, "limit precision down 100,10");
value = gpm_precision_round_down (100, 10);
if (value == 100) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision up 0,10");
+ egg_test_title (test, "limit precision up 0,10");
value = gpm_precision_round_up (0, 10);
if (value == 10) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision up 4,10");
+ egg_test_title (test, "limit precision up 4,10");
value = gpm_precision_round_up (4, 10);
if (value == 10) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision up 11,10");
+ egg_test_title (test, "limit precision up 11,10");
value = gpm_precision_round_up (11, 10);
if (value == 20) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision up 201,2");
+ egg_test_title (test, "limit precision up 201,2");
value = gpm_precision_round_up (201, 2);
if (value == 202) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "limit precision up 100,10");
+ egg_test_title (test, "limit precision up 100,10");
value = gpm_precision_round_up (100, 10);
if (value == 100) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "precision incorrect (%i)", value);
+ egg_test_failed (test, "precision incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "convert discrete 0/10 levels");
+ egg_test_title (test, "convert discrete 0/10 levels");
value = gpm_discrete_to_percent (0, 10);
if (value == 0) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "conversion incorrect (%i)", value);
+ egg_test_failed (test, "conversion incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "convert discrete 9/10 levels");
+ egg_test_title (test, "convert discrete 9/10 levels");
value = gpm_discrete_to_percent (9, 10);
if (value == 100) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "conversion incorrect (%i)", value);
+ egg_test_failed (test, "conversion incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "convert discrete 20/10 levels");
+ egg_test_title (test, "convert discrete 20/10 levels");
value = gpm_discrete_to_percent (20, 10);
if (value == 100) {
- gpm_st_success (test, "got %i", value);
+ egg_test_success (test, "got %i", value);
} else {
- gpm_st_failed (test, "conversion incorrect (%i)", value);
+ egg_test_failed (test, "conversion incorrect (%i)", value);
}
/************************************************************/
- gpm_st_title (test, "convert discrete 0/10 levels");
+ egg_test_title (test, "convert discrete 0/10 levels");
fvalue = gpm_discrete_to_fraction (0, 10);
if (fvalue > -0.01 && fvalue < 0.01) {
- gpm_st_success (test, "got %f", fvalue);
+ egg_test_success (test, "got %f", fvalue);
} else {
- gpm_st_failed (test, "conversion incorrect (%f)", fvalue);
+ egg_test_failed (test, "conversion incorrect (%f)", fvalue);
}
/************************************************************/
- gpm_st_title (test, "convert discrete 9/10 levels");
+ egg_test_title (test, "convert discrete 9/10 levels");
fvalue = gpm_discrete_to_fraction (9, 10);
if (fvalue > -1.01 && fvalue < 1.01) {
- gpm_st_success (test, "got %f", fvalue);
+ egg_test_success (test, "got %f", fvalue);
} else {
- gpm_st_failed (test, "conversion incorrect (%f)", fvalue);
+ egg_test_failed (test, "conversion incorrect (%f)", fvalue);
}
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-graph-widget.c
==============================================================================
--- trunk/src/gpm-graph-widget.c (original)
+++ trunk/src/gpm-graph-widget.c Thu Sep 4 10:49:23 2008
@@ -1305,8 +1305,8 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
GtkWidget *window;
GtkWidget *graph;
@@ -1322,21 +1322,21 @@
static void
clicked_passed_cb (GtkWidget *widget, gpointer gdata)
{
- GpmSelfTest *test = (GpmSelfTest *) gdata;
- gpm_st_success (test, NULL);
+ EggTest *test = (EggTest *) gdata;
+ egg_test_success (test, NULL);
gtk_main_quit ();
}
static void
clicked_failed_cb (GtkWidget *widget, gpointer gdata)
{
- GpmSelfTest *test = (GpmSelfTest *) gdata;
- gpm_st_failed (test, NULL);
+ EggTest *test = (EggTest *) gdata;
+ egg_test_failed (test, NULL);
gtk_main_quit ();
}
static void
-create_graph_window (GpmSelfTest *test)
+create_graph_window (EggTest *test)
{
GtkWidget *button_passed;
GtkWidget *button_failed;
@@ -1369,7 +1369,7 @@
}
static void
-wait_for_input (GpmSelfTest *test)
+wait_for_input (EggTest *test)
{
gtk_widget_hide_all (window);
gtk_widget_show_all (window);
@@ -1377,28 +1377,28 @@
}
void
-gpm_st_title_graph (GpmSelfTest *test, const gchar *format, ...)
+egg_test_title_graph (EggTest *test, const gchar *format, ...)
{
va_list args;
gchar va_args_buffer [1025];
va_start (args, format);
g_vsnprintf (va_args_buffer, 1024, format, args);
va_end (args);
- gpm_st_title (test, va_args_buffer);
+ egg_test_title (test, va_args_buffer);
gtk_label_set_label (GTK_LABEL (label), va_args_buffer);
// g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
// test->total++;
}
void
-gpm_st_graph_widget (GpmSelfTest *test)
+gpm_graph_widget_test (EggTest *test)
{
GpmArray *data;
GpmArray *data_more;
GpmArray *events;
gboolean ret;
- if (gpm_st_start (test, "GpmGraphWidget") == FALSE) {
+ if (egg_test_start (test, "GpmGraphWidget") == FALSE) {
return;
}
@@ -1407,13 +1407,13 @@
gpm_graph_widget_enable_events (GPM_GRAPH_WIDGET (graph), TRUE);
/********** TYPES *************/
- gpm_st_title_graph (test, "graph loaded, visible, no key, and set to y=percent x=time");
+ egg_test_title_graph (test, "graph loaded, visible, no key, and set to y=percent x=time");
wait_for_input (test);
gpm_graph_widget_set_axis_type_x (GPM_GRAPH_WIDGET (graph), GPM_GRAPH_WIDGET_TYPE_PERCENTAGE);
gpm_graph_widget_set_axis_type_y (GPM_GRAPH_WIDGET (graph), GPM_GRAPH_WIDGET_TYPE_TIME);
- gpm_st_title_graph (test, "now set to y=time x=percent");
+ egg_test_title_graph (test, "now set to y=time x=percent");
wait_for_input (test);
/********** KEY DATA *************/
@@ -1421,12 +1421,12 @@
gpm_graph_widget_key_data_add (GPM_GRAPH_WIDGET (graph), EGG_COLOR_GREEN, "green data");
gpm_graph_widget_key_data_add (GPM_GRAPH_WIDGET (graph), EGG_COLOR_BLUE, "blue data");
- gpm_st_title_graph (test, "red green blue key data added");
+ egg_test_title_graph (test, "red green blue key data added");
wait_for_input (test);
gpm_graph_widget_key_data_clear (GPM_GRAPH_WIDGET (graph));
- gpm_st_title_graph (test, "data items cleared, no key remains");
+ egg_test_title_graph (test, "data items cleared, no key remains");
wait_for_input (test);
/********** KEY EVENT *************/
@@ -1447,25 +1447,25 @@
GPM_GRAPH_WIDGET_SHAPE_DIAMOND,
"white diamond");
- gpm_st_title_graph (test, "red green blue white key events added");
+ egg_test_title_graph (test, "red green blue white key events added");
wait_for_input (test);
/********** KEY EVENT duplicate test *************/
- gpm_st_title (test, "duplicate key event test");
+ egg_test_title (test, "duplicate key event test");
ret = gpm_graph_widget_key_event_add (GPM_GRAPH_WIDGET (graph), 3,
EGG_COLOR_WHITE,
GPM_GRAPH_WIDGET_SHAPE_DIAMOND,
"white diamond");
if (!ret) {
- gpm_st_success (test, "refused duplicate id");
+ egg_test_success (test, "refused duplicate id");
} else {
- gpm_st_failed (test, "added duplicate ID!");
+ egg_test_failed (test, "added duplicate ID!");
}
gpm_graph_widget_key_event_clear (GPM_GRAPH_WIDGET (graph));
- gpm_st_title_graph (test, "event items cleared, no key remains");
+ egg_test_title_graph (test, "event items cleared, no key remains");
wait_for_input (test);
/********** DATA *************/
@@ -1483,24 +1483,24 @@
gpm_array_append (data, 50, 0, EGG_COLOR_RED);
gpm_array_append (data, 40, 100, EGG_COLOR_RED);
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
- gpm_st_title (test, "add invalid data");
+ egg_test_title (test, "add invalid data");
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
if (!ret) {
- gpm_st_success (test, "ignored");
+ egg_test_success (test, "ignored");
} else {
- gpm_st_failed (test, "failed to ignore invalid data");
+ egg_test_failed (test, "failed to ignore invalid data");
}
g_object_unref (data);
/********** ADD NO DATA *************/
data = gpm_array_new ();
- gpm_st_title (test, "add zero data");
+ egg_test_title (test, "add zero data");
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
if (!ret) {
- gpm_st_success (test, "ignored");
+ egg_test_success (test, "ignored");
} else {
- gpm_st_failed (test, "failed to ignore zero data");
+ egg_test_failed (test, "failed to ignore zero data");
}
g_object_unref (data);
@@ -1508,16 +1508,16 @@
data = gpm_array_new ();
gpm_array_append (data, 0, 0, EGG_COLOR_RED);
gpm_array_append (data, 100, 100, EGG_COLOR_RED);
- gpm_st_title (test, "add valid data");
+ egg_test_title (test, "add valid data");
ret = gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
if (ret) {
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
} else {
- gpm_st_failed (test, "failed to add valid data");
+ egg_test_failed (test, "failed to add valid data");
}
/********** SHOW VALID DATA *************/
- gpm_st_title_graph (test, "red line shown gradient up");
+ egg_test_title_graph (test, "red line shown gradient up");
wait_for_input (test);
/*********** second line **************/
@@ -1526,7 +1526,7 @@
gpm_array_append (data_more, 100, 0, EGG_COLOR_BLUE);
gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data_more);
- gpm_st_title_graph (test, "red line shown gradient up, blue gradient down");
+ egg_test_title_graph (test, "red line shown gradient up, blue gradient down");
wait_for_input (test);
/*********** dots **************/
@@ -1536,7 +1536,7 @@
gpm_array_append (events, 75, 0, 0);
gpm_graph_widget_events_add (GPM_GRAPH_WIDGET (graph), events);
- gpm_st_title_graph (test, "events follow red line (primary)");
+ egg_test_title_graph (test, "events follow red line (primary)");
wait_for_input (test);
/*********** stacked dots **************/
@@ -1544,17 +1544,17 @@
gpm_array_append (events, 77, 0, 0);
gpm_graph_widget_events_add (GPM_GRAPH_WIDGET (graph), events);
- gpm_st_title_graph (test, "three events stacked at ~75");
+ egg_test_title_graph (test, "three events stacked at ~75");
wait_for_input (test);
/*********** events removed **************/
gpm_graph_widget_events_clear (GPM_GRAPH_WIDGET (graph));
- gpm_st_title_graph (test, "events removed");
+ egg_test_title_graph (test, "events removed");
wait_for_input (test);
/*********** data lines removed **************/
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
- gpm_st_title_graph (test, "all lines and event removed");
+ egg_test_title_graph (test, "all lines and event removed");
wait_for_input (test);
g_object_unref (events);
@@ -1574,7 +1574,7 @@
gpm_array_append (data, 80, 78, EGG_COLOR_RED);
gpm_array_append (data, 100, 79, EGG_COLOR_RED);
gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
- gpm_st_title_graph (test, "autorange y axis between 70 and 80");
+ egg_test_title_graph (test, "autorange y axis between 70 and 80");
wait_for_input (test);
g_object_unref (data);
@@ -1584,14 +1584,14 @@
gpm_array_append (data, 100, 85, EGG_COLOR_RED);
gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (graph));
gpm_graph_widget_data_add (GPM_GRAPH_WIDGET (graph), data);
- gpm_st_title_graph (test, "autorange y axis between 0 and 100");
+ egg_test_title_graph (test, "autorange y axis between 0 and 100");
wait_for_input (test);
g_object_unref (data);
/* hide window */
gtk_widget_hide_all (window);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c (original)
+++ trunk/src/gpm-inhibit.c Thu Sep 4 10:49:23 2008
@@ -518,8 +518,8 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
#include <libdbus-proxy.h>
#include "gpm-common.h"
@@ -617,7 +617,7 @@
}
void
-gpm_st_inhibit (GpmSelfTest *test)
+gpm_inhibit_test (EggTest *test)
{
gboolean ret;
gboolean valid;
@@ -625,7 +625,7 @@
guint cookie2 = 0;
DbusProxy *gproxy;
- if (gpm_st_start (test, "GpmInhibit") == FALSE) {
+ if (egg_test_start (test, "GpmInhibit") == FALSE) {
return;
}
@@ -641,96 +641,96 @@
}
/************************************************************/
- gpm_st_title (test, "make sure we are not inhibited");
+ egg_test_title (test, "make sure we are not inhibited");
ret = has_inhibit (gproxy, &valid);
if (!ret) {
- gpm_st_failed (test, "Unable to test validity");
+ egg_test_failed (test, "Unable to test validity");
} else if (valid) {
- gpm_st_failed (test, "Already inhibited");
+ egg_test_failed (test, "Already inhibited");
} else {
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
}
/************************************************************/
- gpm_st_title (test, "clear an invalid cookie");
+ egg_test_title (test, "clear an invalid cookie");
ret = uninhibit (gproxy, 123456);
if (!ret) {
- gpm_st_success (test, "invalid cookie failed as expected");
+ egg_test_success (test, "invalid cookie failed as expected");
} else {
- gpm_st_failed (test, "should have rejected invalid cookie");
+ egg_test_failed (test, "should have rejected invalid cookie");
}
/************************************************************/
- gpm_st_title (test, "get auto cookie 1");
+ egg_test_title (test, "get auto cookie 1");
ret = inhibit (gproxy,
"gnome-power-self-test",
"test inhibit",
&cookie1);
if (!ret) {
- gpm_st_failed (test, "Unable to inhibit");
+ egg_test_failed (test, "Unable to inhibit");
} else if (cookie1 == 0) {
- gpm_st_failed (test, "Cookie invalid (cookie: %u)", cookie1);
+ egg_test_failed (test, "Cookie invalid (cookie: %u)", cookie1);
} else {
- gpm_st_success (test, "cookie: %u", cookie1);
+ egg_test_success (test, "cookie: %u", cookie1);
}
/************************************************************/
- gpm_st_title (test, "make sure we are auto inhibited");
+ egg_test_title (test, "make sure we are auto inhibited");
ret = has_inhibit (gproxy, &valid);
if (!ret) {
- gpm_st_failed (test, "Unable to test validity");
+ egg_test_failed (test, "Unable to test validity");
} else if (valid) {
- gpm_st_success (test, "inhibited");
+ egg_test_success (test, "inhibited");
} else {
- gpm_st_failed (test, "inhibit failed");
+ egg_test_failed (test, "inhibit failed");
}
/************************************************************/
- gpm_st_title (test, "get cookie 2");
+ egg_test_title (test, "get cookie 2");
ret = inhibit (gproxy,
"gnome-power-self-test",
"test inhibit",
&cookie2);
if (!ret) {
- gpm_st_failed (test, "Unable to inhibit");
+ egg_test_failed (test, "Unable to inhibit");
} else if (cookie2 == 0) {
- gpm_st_failed (test, "Cookie invalid (cookie: %u)", cookie2);
+ egg_test_failed (test, "Cookie invalid (cookie: %u)", cookie2);
} else {
- gpm_st_success (test, "cookie: %u", cookie2);
+ egg_test_success (test, "cookie: %u", cookie2);
}
/************************************************************/
- gpm_st_title (test, "clear cookie 1");
+ egg_test_title (test, "clear cookie 1");
ret = uninhibit (gproxy, cookie1);
if (!ret) {
- gpm_st_failed (test, "cookie failed to clear");
+ egg_test_failed (test, "cookie failed to clear");
} else {
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
}
/************************************************************/
- gpm_st_title (test, "make sure we are still inhibited");
+ egg_test_title (test, "make sure we are still inhibited");
ret = has_inhibit (gproxy, &valid);
if (!ret) {
- gpm_st_failed (test, "Unable to test validity");
+ egg_test_failed (test, "Unable to test validity");
} else if (valid) {
- gpm_st_success (test, "inhibited");
+ egg_test_success (test, "inhibited");
} else {
- gpm_st_failed (test, "inhibit failed");
+ egg_test_failed (test, "inhibit failed");
}
/************************************************************/
- gpm_st_title (test, "clear cookie 2");
+ egg_test_title (test, "clear cookie 2");
ret = uninhibit (gproxy, cookie2);
if (!ret) {
- gpm_st_failed (test, "cookie failed to clear");
+ egg_test_failed (test, "cookie failed to clear");
} else {
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
}
g_object_unref (gproxy);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-phone.c
==============================================================================
--- trunk/src/gpm-phone.c (original)
+++ trunk/src/gpm-phone.c Thu Sep 4 10:49:23 2008
@@ -416,13 +416,13 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
static gboolean test_got_refresh = FALSE;
static void
-gpm_st_mainloop_wait (guint ms)
+egg_test_mainloop_wait (guint ms)
{
GMainLoop *loop;
loop = g_main_loop_new (NULL, FALSE);
@@ -442,23 +442,23 @@
}
void
-gpm_st_phone (GpmSelfTest *test)
+gpm_phone_test (EggTest *test)
{
GpmPhone *phone;
guint value;
gboolean ret;
- if (gpm_st_start (test, "GpmPhone") == FALSE) {
+ if (egg_test_start (test, "GpmPhone") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null phone");
+ egg_test_title (test, "make sure we get a non null phone");
phone = gpm_phone_new ();
if (phone != NULL) {
- gpm_st_success (test, "got GpmPhone");
+ egg_test_success (test, "got GpmPhone");
} else {
- gpm_st_failed (test, "could not get GpmPhone");
+ egg_test_failed (test, "could not get GpmPhone");
}
/* connect signals */
@@ -466,71 +466,73 @@
G_CALLBACK (phone_device_refresh_cb), GUINT_TO_POINTER(44));
/************************************************************/
- gpm_st_title (test, "make sure we got a connection");
+ egg_test_title (test, "make sure we got a connection");
if (phone->priv->proxy != NULL) {
- gpm_st_success (test, "got connection");
+ egg_test_success (test, "got connection");
} else {
- gpm_st_failed (test, "could not get a connection!");
+ /* skip this part of the test */
+ egg_test_success (test, "could not get a connection!");
+ goto out;
}
/************************************************************/
- gpm_st_title (test, "coldplug the data");
+ egg_test_title (test, "coldplug the data");
ret = gpm_phone_coldplug (phone);
if (ret) {
- gpm_st_success (test, "coldplug okay");
+ egg_test_success (test, "coldplug okay");
} else {
- gpm_st_failed (test, "could not coldplug");
+ egg_test_failed (test, "could not coldplug");
}
- gpm_st_mainloop_wait (500);
+ egg_test_mainloop_wait (500);
/************************************************************/
- gpm_st_title (test, "got refresh");
+ egg_test_title (test, "got refresh");
if (test_got_refresh) {
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
} else {
- gpm_st_failed (test, "did not get refresh");
+ egg_test_failed (test, "did not get refresh");
}
/************************************************************/
- gpm_st_title (test, "check the connected phones");
+ egg_test_title (test, "check the connected phones");
value = gpm_phone_get_num_batteries (phone);
if (value == 1) {
- gpm_st_success (test, "connected phone");
+ egg_test_success (test, "connected phone");
} else {
- gpm_st_failed (test, "not connected with %i (phone not connected?)", value);
+ egg_test_failed (test, "not connected with %i (phone not connected?)", value);
}
/************************************************************/
- gpm_st_title (test, "check the present value");
+ egg_test_title (test, "check the present value");
ret = gpm_phone_get_present (phone, 0);
if (ret) {
- gpm_st_success (test, "we are here!");
+ egg_test_success (test, "we are here!");
} else {
- gpm_st_failed (test, "not here...");
+ egg_test_failed (test, "not here...");
}
/************************************************************/
- gpm_st_title (test, "check the percentage");
+ egg_test_title (test, "check the percentage");
value = gpm_phone_get_percentage (phone, 0);
if (value != 0) {
- gpm_st_success (test, "percentage is %i", phone->priv->percentage);
+ egg_test_success (test, "percentage is %i", phone->priv->percentage);
} else {
- gpm_st_failed (test, "could not get value");
+ egg_test_failed (test, "could not get value");
}
/************************************************************/
- gpm_st_title (test, "check the ac value");
+ egg_test_title (test, "check the ac value");
ret = gpm_phone_get_on_ac (phone, 0);
if (!ret) {
- gpm_st_success (test, "not charging, correct");
+ egg_test_success (test, "not charging, correct");
} else {
- gpm_st_failed (test, "charging?");
+ egg_test_failed (test, "charging?");
}
-
+out:
g_object_unref (phone);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-profile.c
==============================================================================
--- trunk/src/gpm-profile.c (original)
+++ trunk/src/gpm-profile.c Thu Sep 4 10:49:23 2008
@@ -992,8 +992,8 @@
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
-#ifdef GPM_BUILD_TESTS
-#include "gpm-self-test.h"
+#ifdef EGG_TEST
+#include "egg-test.h"
static void
reset_profile (GpmProfile *profile)
@@ -1005,7 +1005,7 @@
}
void
-gpm_st_profile (GpmSelfTest *test)
+gpm_profile_test (EggTest *test)
{
GpmProfile *profile;
gboolean ret;
@@ -1014,35 +1014,35 @@
guint value;
gfloat fvalue;
- if (gpm_st_start (test, "GpmProfile") == FALSE) {
+ if (egg_test_start (test, "GpmProfile") == FALSE) {
return;
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non null profile");
+ egg_test_title (test, "make sure we get a non null profile");
profile = gpm_profile_new ();
if (profile != NULL) {
- gpm_st_success (test, "got GpmProfile");
+ egg_test_success (test, "got GpmProfile");
} else {
- gpm_st_failed (test, "could not get GpmProfile");
+ egg_test_failed (test, "could not get GpmProfile");
}
/************************************************************/
- gpm_st_title (test, "make sure we get a zero accuracy when no-id");
+ egg_test_title (test, "make sure we get a zero accuracy when no-id");
value = gpm_profile_get_accuracy (profile, 50);
if (value == 0) {
- gpm_st_success (test, "got zero");
+ egg_test_success (test, "got zero");
} else {
- gpm_st_failed (test, "got %i", value);
+ egg_test_failed (test, "got %i", value);
}
/************************************************************/
- gpm_st_title (test, "set config id");
+ egg_test_title (test, "set config id");
ret = gpm_profile_set_config_id (profile, "test123");
if (ret) {
- gpm_st_success (test, "set type");
+ egg_test_success (test, "set type");
} else {
- gpm_st_failed (test, "could not set type");
+ egg_test_failed (test, "could not set type");
}
@@ -1051,22 +1051,22 @@
************************************************************/
/************************************************************/
- gpm_st_title (test, "get correct charging filename");
+ egg_test_title (test, "get correct charging filename");
filename = gpm_profile_get_data_file (profile, FALSE);
if (strstr (filename, "/.gnome2/gnome-power-manager/profile-test123-charging.csv") != NULL) {
- gpm_st_success (test, "got correct filename");
+ egg_test_success (test, "got correct filename");
} else {
- gpm_st_failed (test, "got incorrect filename: %s", filename);
+ egg_test_failed (test, "got incorrect filename: %s", filename);
}
g_free (filename);
/************************************************************/
- gpm_st_title (test, "get correct discharging filename");
+ egg_test_title (test, "get correct discharging filename");
filename = gpm_profile_get_data_file (profile, TRUE);
if (strstr (filename, "/.gnome2/gnome-power-manager/profile-test123-discharging.csv") != NULL) {
- gpm_st_success (test, "got correct filename");
+ egg_test_success (test, "got correct filename");
} else {
- gpm_st_failed (test, "got incorrect filename: %s", filename);
+ egg_test_failed (test, "got incorrect filename: %s", filename);
}
g_free (filename);
@@ -1074,21 +1074,21 @@
reset_profile (profile);
/************************************************************/
- gpm_st_title (test, "make sure we get a zero accuracy with a new dataset");
+ egg_test_title (test, "make sure we get a zero accuracy with a new dataset");
value = gpm_profile_get_accuracy (profile, 50);
if (value == 0) {
- gpm_st_success (test, "got zero");
+ egg_test_success (test, "got zero");
} else {
- gpm_st_failed (test, "got %i (not zero!)", value);
+ egg_test_failed (test, "got %i (not zero!)", value);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a zero time with a new dataset");
+ egg_test_title (test, "make sure we get a zero time with a new dataset");
value = gpm_profile_get_time (profile, 50, TRUE);
if (value == 0) {
- gpm_st_success (test, "got zero");
+ egg_test_success (test, "got zero");
} else {
- gpm_st_failed (test, "got %i", value);
+ egg_test_failed (test, "got %i", value);
}
/************************************************************
@@ -1096,42 +1096,42 @@
************************************************************/
/************************************************************/
- gpm_st_title (test, "force discharging");
+ egg_test_title (test, "force discharging");
gpm_profile_test_force_discharging (profile, TRUE);
- gpm_st_success (test, NULL);
+ egg_test_success (test, NULL);
/************************************************************/
- gpm_st_title (test, "ignore first point");
+ egg_test_title (test, "ignore first point");
ret = gpm_profile_register_percentage (profile, 99);
if (!ret) {
- gpm_st_success (test, "ignored first");
+ egg_test_success (test, "ignored first");
} else {
- gpm_st_failed (test, "ignored second");
+ egg_test_failed (test, "ignored second");
}
/************************************************************/
- gpm_st_title (test, "make up discharging dataset 98-0 (perfect accuracy)");
+ egg_test_title (test, "make up discharging dataset 98-0 (perfect accuracy)");
for (i=98; i>=0; i--) {
gpm_profile_save_percentage (profile, i, 120, 100);
}
- gpm_st_success (test, "put dataset");
+ egg_test_success (test, "put dataset");
/************************************************************/
- gpm_st_title (test, "make sure we get a correct accuracy when a complete dataset");
+ egg_test_title (test, "make sure we get a correct accuracy when a complete dataset");
value = gpm_profile_get_accuracy (profile, 50);
if (value == 20) {
- gpm_st_success (test, "got correct average %i", value);
+ egg_test_success (test, "got correct average %i", value);
} else {
- gpm_st_failed (test, "got incorrect average %i", value);
+ egg_test_failed (test, "got incorrect average %i", value);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a correct discharge time when set");
+ egg_test_title (test, "make sure we get a correct discharge time when set");
value = gpm_profile_get_time (profile, 50, TRUE);
if (value == 6120) {
- gpm_st_success (test, "got correct time %i", value);
+ egg_test_success (test, "got correct time %i", value);
} else {
- gpm_st_failed (test, "got incorrect time %i", value);
+ egg_test_failed (test, "got incorrect time %i", value);
}
/************************************************************
@@ -1142,36 +1142,36 @@
reset_profile (profile);
/************************************************************/
- gpm_st_title (test, "single point of accuracy with no guessing (new profile)");
+ egg_test_title (test, "single point of accuracy with no guessing (new profile)");
gpm_profile_use_guessing (profile, FALSE);
gpm_profile_save_percentage (profile, 45, 120, 100);
- gpm_st_success (test, "put single point");
+ egg_test_success (test, "put single point");
/************************************************************/
- gpm_st_title (test, "make sure we get a correct accuracy when a single point dataset");
+ egg_test_title (test, "make sure we get a correct accuracy when a single point dataset");
value = gpm_profile_get_accuracy (profile, 45);
if (value == 20) {
- gpm_st_success (test, "got correct average %i", value);
+ egg_test_success (test, "got correct average %i", value);
} else {
- gpm_st_failed (test, "got incorrect average %i", value);
+ egg_test_failed (test, "got incorrect average %i", value);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a correct time when set");
+ egg_test_title (test, "make sure we get a correct time when set");
value = gpm_profile_get_time (profile, 50, TRUE);
if (value == 120) {
- gpm_st_success (test, "got correct time %i", value);
+ egg_test_success (test, "got correct time %i", value);
} else {
- gpm_st_failed (test, "got incorrect time %i", value);
+ egg_test_failed (test, "got incorrect time %i", value);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a non-zero average accuracy when some data present");
+ egg_test_title (test, "make sure we get a non-zero average accuracy when some data present");
fvalue = gpm_profile_get_accuracy_average (profile, TRUE);
if (fvalue < 0.21 && fvalue > 0.19) {
- gpm_st_success (test, "got non zero %f", fvalue);
+ egg_test_success (test, "got non zero %f", fvalue);
} else {
- gpm_st_failed (test, "got %f", fvalue);
+ egg_test_failed (test, "got %f", fvalue);
}
/************************************************************
@@ -1182,36 +1182,36 @@
reset_profile (profile);
/************************************************************/
- gpm_st_title (test, "single point of accuracy with guessing (new profile)");
+ egg_test_title (test, "single point of accuracy with guessing (new profile)");
gpm_profile_use_guessing (profile, TRUE);
gpm_profile_save_percentage (profile, 45, 120, 100);
- gpm_st_success (test, "put single point");
+ egg_test_success (test, "put single point");
/************************************************************/
- gpm_st_title (test, "make sure we get a correct accuracy when a single point dataset");
+ egg_test_title (test, "make sure we get a correct accuracy when a single point dataset");
value = gpm_profile_get_accuracy (profile, 45);
if (value == 20) {
- gpm_st_success (test, "got correct average %i", value);
+ egg_test_success (test, "got correct average %i", value);
} else {
- gpm_st_failed (test, "got incorrect average %i", value);
+ egg_test_failed (test, "got incorrect average %i", value);
}
/************************************************************/
- gpm_st_title (test, "make sure the point after the guessed point isn't guessed");
+ egg_test_title (test, "make sure the point after the guessed point isn't guessed");
value = gpm_profile_get_accuracy (profile, 46);
if (value == 0) {
- gpm_st_success (test, "didn't try to guess point after set", value);
+ egg_test_success (test, "didn't try to guess point after set", value);
} else {
- gpm_st_failed (test, "got accuracy average %i", value);
+ egg_test_failed (test, "got accuracy average %i", value);
}
/************************************************************/
- gpm_st_title (test, "make sure we get a correct time when set");
+ egg_test_title (test, "make sure we get a correct time when set");
value = gpm_profile_get_time (profile, 50, TRUE);
if (value == 5280) {
- gpm_st_success (test, "got correct time %i", value);
+ egg_test_success (test, "got correct time %i", value);
} else {
- gpm_st_failed (test, "got incorrect time!!! %i", value);
+ egg_test_failed (test, "got incorrect time!!! %i", value);
}
/************************************************************/
@@ -1220,7 +1220,7 @@
g_object_unref (profile);
- gpm_st_end (test);
+ egg_test_end (test);
}
#endif
Modified: trunk/src/gpm-self-test.c
==============================================================================
--- trunk/src/gpm-self-test.c (original)
+++ trunk/src/gpm-self-test.c Thu Sep 4 10:49:23 2008
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2007-2008 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -20,177 +20,64 @@
*/
#include "config.h"
-#include <stdlib.h>
+
#include <glib.h>
-#include <string.h>
-#include <glib/gi18n.h>
+#include <glib-object.h>
#include <gtk/gtk.h>
-
+#include "egg-test.h"
#include "egg-debug.h"
-#include "gpm-self-test.h"
-
-gboolean
-gpm_st_start (GpmSelfTest *test, const gchar *name)
-{
- if (test->started) {
- g_print ("Not ended test! Cannot start!\n");
- exit (1);
- }
- test->type = g_strdup (name);
- test->started = TRUE;
- g_print ("%s...", test->type);
- return TRUE;
-}
-
-void
-gpm_st_end (GpmSelfTest *test)
-{
- if (test->started == FALSE) {
- g_print ("Not started test! Cannot finish!\n");
- exit (1);
- }
- g_print ("OK\n");
- test->started = FALSE;
- g_free (test->type);
-}
-
-void
-gpm_st_title (GpmSelfTest *test, const gchar *format, ...)
-{
- va_list args;
- gchar va_args_buffer [1025];
- va_start (args, format);
- g_vsnprintf (va_args_buffer, 1024, format, args);
- va_end (args);
- g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
- test->total++;
-}
-
-void
-gpm_st_success (GpmSelfTest *test, const gchar *format, ...)
-{
- va_list args;
- gchar va_args_buffer [1025];
- if (format == NULL) {
- g_print ("...OK\n");
- goto finish;
- }
- va_start (args, format);
- g_vsnprintf (va_args_buffer, 1024, format, args);
- va_end (args);
- g_print ("...OK [%s]\n", va_args_buffer);
-finish:
- test->succeeded++;
-}
-void
-gpm_st_failed (GpmSelfTest *test, const gchar *format, ...)
-{
- va_list args;
- gchar va_args_buffer [1025];
- if (format == NULL) {
- g_print ("FAILED\n");
- goto failed;
- }
- va_start (args, format);
- g_vsnprintf (va_args_buffer, 1024, format, args);
- va_end (args);
- g_print ("FAILED [%s]\n", va_args_buffer);
-failed:
- exit (1);
-}
-
-void
-gpm_st_warning (GpmSelfTest *test, const gchar *format, ...)
-{
- va_list args;
- gchar va_args_buffer [1025];
- if (format == NULL) {
- g_print ("UNKNOWN WARNING\n");
- goto out;
- }
- va_start (args, format);
- g_vsnprintf (va_args_buffer, 1024, format, args);
- va_end (args);
- g_print ("WARNING [%s]\n", va_args_buffer);
-out:
- ;
-}
-
-static void
-gpm_st_run_test (GpmSelfTest *test, GpmSelfTestFunc func)
-{
- func (test);
-}
+/* prototypes */
+void gpm_common_test (EggTest *test);
+void gpm_array_float_test (EggTest *test);
+void gpm_array_test (EggTest *test);
+void gpm_cell_unit_test (EggTest *test);
+void gpm_cell_test (EggTest *test);
+void gpm_cell_test_array (EggTest *test);
+void gpm_inhibit_test (EggTest *test);
+void gpm_profile_test (EggTest *test);
+void gpm_phone_test (EggTest *test);
+void gpm_graph_widget_test (EggTest *test);
+void gpm_proxy_test (EggTest *test);
+void gpm_hal_power_test (EggTest *test);
+void gpm_hal_manager_test (EggTest *test);
+void gpm_device_test (EggTest *test);
+void gpm_device_teststore (EggTest *test);
+void gpm_idletime_test (EggTest *test);
int
main (int argc, char **argv)
{
- GOptionContext *context;
- int retval;
-
- gboolean verbose = FALSE;
- char *level = NULL;
- char **tests = NULL;
-
- const GOptionEntry options[] = {
- { "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose,
- "Show verbose debugging information", NULL },
- { "level", '\0', 0, G_OPTION_ARG_STRING, &level,
- "Set the printing level, [quiet|normal|all]", NULL },
- { "tests", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &tests,
- "Debug specific modules, [common,webcam,arrayfloat]", NULL },
- { NULL}
- };
-
- context = g_option_context_new ("GNOME Power Manager Self Test");
- g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (FALSE));
- g_option_context_parse (context, &argc, &argv, NULL);
- gtk_init (&argc, &argv);
+ EggTest *test;
- egg_debug_init (verbose);
+ g_type_init ();
+ test = egg_test_init ();
+ egg_debug_init (TRUE);
- GpmSelfTest ttest;
- GpmSelfTest *test = &ttest;
- test->total = 0;
- test->succeeded = 0;
- test->type = NULL;
- test->started = FALSE;
-
- /* auto */
- gpm_st_run_test (test, gpm_st_common);
- gpm_st_run_test (test, gpm_st_array_float);
- gpm_st_run_test (test, gpm_st_array);
- gpm_st_run_test (test, gpm_st_cell_unit);
- gpm_st_run_test (test, gpm_st_cell);
- gpm_st_run_test (test, gpm_st_cell_array);
- gpm_st_run_test (test, gpm_st_inhibit);
- gpm_st_run_test (test, gpm_st_profile);
- gpm_st_run_test (test, gpm_st_phone);
+ /* needed for DPMS checks */
+ gtk_init (&argc, &argv);
- /* manual */
- gpm_st_run_test (test, gpm_st_graph_widget);
+ /* tests go here */
+ gpm_common_test (test);
+ gpm_array_float_test (test);
+ gpm_array_test (test);
+ gpm_cell_unit_test (test);
+ gpm_cell_test (test);
+ gpm_cell_test_array (test);
+ gpm_inhibit_test (test);
+ gpm_profile_test (test);
+ gpm_phone_test (test);
+// gpm_graph_widget_test (test);
#if 0
- gpm_st_run_test (test, gpm_st_proxy);
- gpm_st_run_test (test, gpm_st_hal_power);
- gpm_st_run_test (test, gpm_st_hal_manager);
- gpm_st_run_test (test, gpm_st_hal_device);
- gpm_st_run_test (test, gpm_st_hal_devicestore);
- gpm_st_run_test (test, gpm_st_idletime);
+ gpm_proxy_test (test);
+ gpm_hal_power_test (test);
+ gpm_hal_manager_test (test);
+ gpm_device_test (test);
+ gpm_device_teststore (test);
+ gpm_idletime_test (test);
#endif
- g_print ("test passes (%u/%u) : ", test->succeeded, test->total);
- if (test->succeeded == test->total) {
- g_print ("ALL OKAY\n");
- retval = 0;
- } else {
- g_print ("%u FAILURE(S)\n", test->total - test->succeeded);
- retval = 1;
- }
-
- g_option_context_free (context);
- return retval;
+ return (egg_test_finish (test));
}
Modified: trunk/src/gpm-self-test.h
==============================================================================
--- trunk/src/gpm-self-test.h (original)
+++ trunk/src/gpm-self-test.h Thu Sep 4 10:49:23 2008
@@ -27,32 +27,32 @@
guint succeeded;
gboolean started;
gchar *type;
-} GpmSelfTest;
+} EggTest;
-typedef void (*GpmSelfTestFunc) (GpmSelfTest *test);
+typedef void (*EggTestFunc) (EggTest *test);
-gboolean gpm_st_start (GpmSelfTest *test, const gchar *name);
-void gpm_st_end (GpmSelfTest *test);
-void gpm_st_title (GpmSelfTest *test, const gchar *format, ...);
-void gpm_st_success (GpmSelfTest *test, const gchar *format, ...);
-void gpm_st_failed (GpmSelfTest *test, const gchar *format, ...);
-void gpm_st_warning (GpmSelfTest *test, const gchar *format, ...);
+gboolean egg_test_start (EggTest *test, const gchar *name);
+void egg_test_end (EggTest *test);
+void egg_test_title (EggTest *test, const gchar *format, ...);
+void egg_test_success (EggTest *test, const gchar *format, ...);
+void egg_test_failed (EggTest *test, const gchar *format, ...);
+void egg_test_warning (EggTest *test, const gchar *format, ...);
-void gpm_st_common (GpmSelfTest *test);
-void gpm_st_profile (GpmSelfTest *test);
-void gpm_st_webcam (GpmSelfTest *test);
-void gpm_st_array (GpmSelfTest *test);
-void gpm_st_idletime (GpmSelfTest *test);
-void gpm_st_array_float (GpmSelfTest *test);
-void gpm_st_cell (GpmSelfTest *test);
-void gpm_st_cell_unit (GpmSelfTest *test);
-void gpm_st_cell_array (GpmSelfTest *test);
-void gpm_st_proxy (GpmSelfTest *test);
-void gpm_st_phone (GpmSelfTest *test);
-void gpm_st_inhibit (GpmSelfTest *test);
-void gpm_st_hal_device (GpmSelfTest *test);
-void gpm_st_hal_devicestore (GpmSelfTest *test);
-void gpm_st_hal_power (GpmSelfTest *test);
-void gpm_st_hal_manager (GpmSelfTest *test);
-void gpm_st_graph_widget (GpmSelfTest *test);
+void gpm_common_test (EggTest *test);
+void gpm_profile_test (EggTest *test);
+void egg_test_webcam (EggTest *test);
+void gpm_array_test (EggTest *test);
+void gpm_idletime_test (EggTest *test);
+void gpm_array_float_test (EggTest *test);
+void gpm_cell_test (EggTest *test);
+void gpm_cell_unit_test (EggTest *test);
+void gpm_cell_test_array (EggTest *test);
+void gpm_proxy_test (EggTest *test);
+void gpm_phone_test (EggTest *test);
+void gpm_inhibit_test (EggTest *test);
+void gpm_device_test (EggTest *test);
+void gpm_device_teststore (EggTest *test);
+void gpm_hal_power_test (EggTest *test);
+void gpm_hal_manager_test (EggTest *test);
+void gpm_graph_widget_test (EggTest *test);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]