2007-11-20 16:01:02 +01:00
|
|
|
/* GLib testing utilities
|
2007-11-20 18:35:26 +01:00
|
|
|
* Copyright (C) 2007 Imendio AB
|
|
|
|
* Authors: Tim Janik
|
2007-11-20 16:00:19 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2008-03-14 20:30:38 +01:00
|
|
|
|
2008-05-05 17:02:15 +02:00
|
|
|
#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
2008-03-14 20:30:38 +01:00
|
|
|
#error "Only <glib.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2007-11-20 16:01:02 +01:00
|
|
|
#ifndef __G_TEST_UTILS_H__
|
|
|
|
#define __G_TEST_UTILS_H__
|
2007-11-20 16:00:23 +01:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2007-12-21 14:58:42 +01:00
|
|
|
G_BEGIN_DECLS
|
2007-11-20 16:00:23 +01:00
|
|
|
|
|
|
|
typedef struct GTestCase GTestCase;
|
|
|
|
typedef struct GTestSuite GTestSuite;
|
|
|
|
|
|
|
|
/* assertion API */
|
2007-11-20 16:00:27 +01:00
|
|
|
#define g_assert_cmpstr(s1, cmp, s2) do { const char *__s1 = (s1), *__s2 = (s2); \
|
|
|
|
if (g_strcmp0 (__s1, __s2) cmp 0) ; else \
|
|
|
|
g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#s1 " " #cmp " " #s2, __s1, #cmp, __s2); } while (0)
|
|
|
|
#define g_assert_cmpint(n1, cmp, n2) do { gint64 __n1 = (n1), __n2 = (n2); \
|
|
|
|
if (__n1 cmp __n2) ; else \
|
|
|
|
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'i'); } while (0)
|
|
|
|
#define g_assert_cmpuint(n1, cmp, n2) do { guint64 __n1 = (n1), __n2 = (n2); \
|
|
|
|
if (__n1 cmp __n2) ; else \
|
|
|
|
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'i'); } while (0)
|
|
|
|
#define g_assert_cmphex(n1, cmp, n2) do { guint64 __n1 = (n1), __n2 = (n2); \
|
|
|
|
if (__n1 cmp __n2) ; else \
|
|
|
|
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'x'); } while (0)
|
|
|
|
#define g_assert_cmpfloat(n1,cmp,n2) do { long double __n1 = (n1), __n2 = (n2); \
|
|
|
|
if (__n1 cmp __n2) ; else \
|
|
|
|
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'f'); } while (0)
|
2008-09-27 03:43:29 +02:00
|
|
|
#define g_assert_no_error(err) do { if (err) \
|
|
|
|
g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#err, err, 0, 0); } while (0)
|
|
|
|
#define g_assert_error(err, dom, c) do { if (!err || (err)->domain != dom || (err)->code != c) \
|
|
|
|
g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#err, err, dom, c); } while (0)
|
2007-12-10 15:07:42 +01:00
|
|
|
#ifdef G_DISABLE_ASSERT
|
|
|
|
#define g_assert_not_reached() do { (void) 0; } while (0)
|
|
|
|
#define g_assert(expr) do { (void) 0; } while (0)
|
|
|
|
#else /* !G_DISABLE_ASSERT */
|
|
|
|
#define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0)
|
|
|
|
#define g_assert(expr) do { if G_LIKELY (expr) ; else \
|
|
|
|
g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
|
|
|
#expr); } while (0)
|
|
|
|
#endif /* !G_DISABLE_ASSERT */
|
|
|
|
|
2007-11-20 16:00:23 +01:00
|
|
|
int g_strcmp0 (const char *str1,
|
|
|
|
const char *str2);
|
|
|
|
|
|
|
|
/* report performance results */
|
|
|
|
void g_test_minimized_result (double minimized_quantity,
|
|
|
|
const char *format,
|
|
|
|
...) G_GNUC_PRINTF (2, 3);
|
|
|
|
void g_test_maximized_result (double maximized_quantity,
|
|
|
|
const char *format,
|
|
|
|
...) G_GNUC_PRINTF (2, 3);
|
|
|
|
|
|
|
|
/* initialize testing framework */
|
|
|
|
void g_test_init (int *argc,
|
|
|
|
char ***argv,
|
|
|
|
...);
|
2007-11-20 16:00:54 +01:00
|
|
|
/* query testing framework config */
|
|
|
|
#define g_test_quick() (g_test_config_vars->test_quick)
|
initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional
2007-11-21 21:06:47 Tim Janik <timj@imendio.com>
* Makefile.decl: initialize automake variables EXTRA_DIST and
TEST_PROGS for unconditional appending via += in other makefiles.
define recursive test targets: test, test-report, perf-report,
full-report, as described here:
http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html
* Makefile.am:
* build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am:
* build/win32/Makefile.am, build/Makefile.am:
* docs/Makefile.am, docs/reference/Makefile.am:
* docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am:
* gmodule/Makefile.am, tests/Makefile.am:
* tests/refcount/Makefile.am, tests/gobject/Makefile.am:
* glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am:
* glib/tests/Makefile.am, glib/pcre/Makefile.am:
* glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am:
* gthread/Makefile.am, glib/Makefile.am:
include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments.
* glib/tests/Makefile.am: removed example testing rules.
* glib/tests/testing.c: conditionalized performance and slow tests.
* glib/gtestutils.h:
* glib/gtestutils.c: work around g_test_config_vars not changing its
exported value after value assignments, aparently due to symbol aliases.
* glib/gtester.c: fixed off-by-one error which produced junk in logs.
* configure.in: check for python >= 2.4 and provide $PYTHON for scripts.
svn path=/trunk/; revision=5914
2007-11-21 21:09:46 +01:00
|
|
|
#define g_test_slow() (!g_test_config_vars->test_quick)
|
2007-12-05 17:22:44 +01:00
|
|
|
#define g_test_thorough() (!g_test_config_vars->test_quick)
|
2007-11-20 16:00:54 +01:00
|
|
|
#define g_test_perf() (g_test_config_vars->test_perf)
|
|
|
|
#define g_test_verbose() (g_test_config_vars->test_verbose)
|
|
|
|
#define g_test_quiet() (g_test_config_vars->test_quiet)
|
2007-11-20 16:00:23 +01:00
|
|
|
/* run all tests under toplevel suite (path: /) */
|
|
|
|
int g_test_run (void);
|
2007-12-05 11:42:09 +01:00
|
|
|
/* hook up a test functions under test path */
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_test_add_func (const char *testpath,
|
|
|
|
void (*test_func) (void));
|
2007-12-05 11:42:09 +01:00
|
|
|
void g_test_add_data_func (const char *testpath,
|
|
|
|
gconstpointer test_data,
|
|
|
|
void (*test_func) (gconstpointer));
|
2007-11-20 16:00:23 +01:00
|
|
|
/* hook up a test with fixture under test path */
|
2007-12-05 11:42:09 +01:00
|
|
|
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
|
2008-02-11 19:28:42 +01:00
|
|
|
G_STMT_START { \
|
|
|
|
void (*add_vtable) (const char*, \
|
2007-12-05 11:42:09 +01:00
|
|
|
gsize, \
|
|
|
|
gconstpointer, \
|
|
|
|
void (*) (Fixture*, gconstpointer), \
|
|
|
|
void (*) (Fixture*, gconstpointer), \
|
2008-02-11 19:28:42 +01:00
|
|
|
void (*) (Fixture*, gconstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer))) g_test_add_vtable; \
|
|
|
|
add_vtable \
|
|
|
|
(testpath, sizeof (Fixture), tdata, fsetup, ftest, fteardown); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2007-11-20 16:00:56 +01:00
|
|
|
/* add test messages to the test report */
|
|
|
|
void g_test_message (const char *format,
|
|
|
|
...) G_GNUC_PRINTF (1, 2);
|
|
|
|
void g_test_bug_base (const char *uri_pattern);
|
|
|
|
void g_test_bug (const char *bug_uri_snippet);
|
2007-11-20 16:00:23 +01:00
|
|
|
/* measure test timings */
|
|
|
|
void g_test_timer_start (void);
|
2007-12-21 14:58:42 +01:00
|
|
|
double g_test_timer_elapsed (void); /* elapsed seconds */
|
|
|
|
double g_test_timer_last (void); /* repeat last elapsed() result */
|
2007-11-20 16:00:23 +01:00
|
|
|
|
|
|
|
/* automatically g_free or g_object_unref upon teardown */
|
|
|
|
void g_test_queue_free (gpointer gfree_pointer);
|
2007-11-20 16:00:57 +01:00
|
|
|
void g_test_queue_destroy (GDestroyNotify destroy_func,
|
|
|
|
gpointer destroy_data);
|
|
|
|
#define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject)
|
2007-11-20 16:00:23 +01:00
|
|
|
|
2007-11-20 16:00:25 +01:00
|
|
|
/* test traps are guards used around forked tests */
|
|
|
|
typedef enum {
|
|
|
|
G_TEST_TRAP_SILENCE_STDOUT = 1 << 7,
|
|
|
|
G_TEST_TRAP_SILENCE_STDERR = 1 << 8,
|
2007-12-21 14:58:42 +01:00
|
|
|
G_TEST_TRAP_INHERIT_STDIN = 1 << 9
|
2007-11-20 16:00:25 +01:00
|
|
|
} GTestTrapFlags;
|
|
|
|
gboolean g_test_trap_fork (guint64 usec_timeout,
|
|
|
|
GTestTrapFlags test_trap_flags);
|
|
|
|
gboolean g_test_trap_has_passed (void);
|
|
|
|
gboolean g_test_trap_reached_timeout (void);
|
2007-12-18 14:43:46 +01:00
|
|
|
#define g_test_trap_assert_passed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 0, 0)
|
|
|
|
#define g_test_trap_assert_failed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 1, 0)
|
|
|
|
#define g_test_trap_assert_stdout(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 2, soutpattern)
|
|
|
|
#define g_test_trap_assert_stdout_unmatched(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 3, soutpattern)
|
|
|
|
#define g_test_trap_assert_stderr(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 4, serrpattern)
|
|
|
|
#define g_test_trap_assert_stderr_unmatched(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 5, serrpattern)
|
2007-11-20 16:00:25 +01:00
|
|
|
|
2007-11-20 16:00:23 +01:00
|
|
|
/* provide seed-able random numbers for tests */
|
2007-11-20 16:00:27 +01:00
|
|
|
#define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15)))
|
|
|
|
gint32 g_test_rand_int (void);
|
|
|
|
gint32 g_test_rand_int_range (gint32 begin,
|
|
|
|
gint32 end);
|
|
|
|
double g_test_rand_double (void);
|
|
|
|
double g_test_rand_double_range (double range_start,
|
2007-11-20 16:00:25 +01:00
|
|
|
double range_end);
|
2007-11-20 16:00:23 +01:00
|
|
|
|
|
|
|
/* semi-internal API */
|
2007-11-20 16:00:25 +01:00
|
|
|
GTestCase* g_test_create_case (const char *test_name,
|
2007-11-20 16:00:23 +01:00
|
|
|
gsize data_size,
|
2007-12-05 11:42:09 +01:00
|
|
|
gconstpointer test_data,
|
2007-11-20 16:00:23 +01:00
|
|
|
void (*data_setup) (void),
|
|
|
|
void (*data_test) (void),
|
|
|
|
void (*data_teardown) (void));
|
2007-11-20 16:00:25 +01:00
|
|
|
GTestSuite* g_test_create_suite (const char *suite_name);
|
|
|
|
GTestSuite* g_test_get_root (void);
|
|
|
|
void g_test_suite_add (GTestSuite *suite,
|
2007-11-20 16:00:23 +01:00
|
|
|
GTestCase *test_case);
|
2007-11-20 16:00:25 +01:00
|
|
|
void g_test_suite_add_suite (GTestSuite *suite,
|
2007-11-20 16:00:23 +01:00
|
|
|
GTestSuite *nestedsuite);
|
2007-11-20 16:00:25 +01:00
|
|
|
int g_test_run_suite (GTestSuite *suite);
|
2007-11-20 16:00:23 +01:00
|
|
|
|
|
|
|
/* internal ABI */
|
2007-11-20 16:00:25 +01:00
|
|
|
void g_test_trap_assertions (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
2007-12-18 14:43:46 +01:00
|
|
|
guint64 assertion_flags, /* 0-pass, 1-fail, 2-outpattern, 4-errpattern */
|
|
|
|
const char *pattern);
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_assertion_message (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
2007-12-31 06:25:25 +01:00
|
|
|
const char *message) G_GNUC_NORETURN;
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_assertion_message_expr (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
2007-12-31 06:25:25 +01:00
|
|
|
const char *expr) G_GNUC_NORETURN;
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_assertion_message_cmpstr (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
|
|
|
const char *expr,
|
|
|
|
const char *arg1,
|
|
|
|
const char *cmp,
|
2007-12-31 06:25:25 +01:00
|
|
|
const char *arg2) G_GNUC_NORETURN;
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_assertion_message_cmpnum (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
|
|
|
const char *expr,
|
|
|
|
long double arg1,
|
|
|
|
const char *cmp,
|
|
|
|
long double arg2,
|
2007-12-31 06:25:25 +01:00
|
|
|
char numtype) G_GNUC_NORETURN;
|
2008-09-27 03:43:29 +02:00
|
|
|
void g_assertion_message_error (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
|
|
|
const char *expr,
|
|
|
|
GError *error,
|
|
|
|
GQuark error_domain,
|
|
|
|
int error_code) G_GNUC_NORETURN;
|
2007-11-20 16:00:23 +01:00
|
|
|
void g_test_add_vtable (const char *testpath,
|
|
|
|
gsize data_size,
|
2007-12-05 11:42:09 +01:00
|
|
|
gconstpointer test_data,
|
2007-11-20 16:00:23 +01:00
|
|
|
void (*data_setup) (void),
|
|
|
|
void (*data_test) (void),
|
|
|
|
void (*data_teardown) (void));
|
2007-11-20 16:00:54 +01:00
|
|
|
typedef struct {
|
initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional
2007-11-21 21:06:47 Tim Janik <timj@imendio.com>
* Makefile.decl: initialize automake variables EXTRA_DIST and
TEST_PROGS for unconditional appending via += in other makefiles.
define recursive test targets: test, test-report, perf-report,
full-report, as described here:
http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html
* Makefile.am:
* build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am:
* build/win32/Makefile.am, build/Makefile.am:
* docs/Makefile.am, docs/reference/Makefile.am:
* docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am:
* gmodule/Makefile.am, tests/Makefile.am:
* tests/refcount/Makefile.am, tests/gobject/Makefile.am:
* glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am:
* glib/tests/Makefile.am, glib/pcre/Makefile.am:
* glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am:
* gthread/Makefile.am, glib/Makefile.am:
include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments.
* glib/tests/Makefile.am: removed example testing rules.
* glib/tests/testing.c: conditionalized performance and slow tests.
* glib/gtestutils.h:
* glib/gtestutils.c: work around g_test_config_vars not changing its
exported value after value assignments, aparently due to symbol aliases.
* glib/gtester.c: fixed off-by-one error which produced junk in logs.
* configure.in: check for python >= 2.4 and provide $PYTHON for scripts.
svn path=/trunk/; revision=5914
2007-11-21 21:09:46 +01:00
|
|
|
gboolean test_initialized;
|
2007-11-20 16:00:54 +01:00
|
|
|
gboolean test_quick; /* disable thorough tests */
|
|
|
|
gboolean test_perf; /* run performance tests */
|
|
|
|
gboolean test_verbose; /* extra info */
|
|
|
|
gboolean test_quiet; /* reduce output */
|
|
|
|
} GTestConfig;
|
initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional
2007-11-21 21:06:47 Tim Janik <timj@imendio.com>
* Makefile.decl: initialize automake variables EXTRA_DIST and
TEST_PROGS for unconditional appending via += in other makefiles.
define recursive test targets: test, test-report, perf-report,
full-report, as described here:
http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html
* Makefile.am:
* build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am:
* build/win32/Makefile.am, build/Makefile.am:
* docs/Makefile.am, docs/reference/Makefile.am:
* docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am:
* gmodule/Makefile.am, tests/Makefile.am:
* tests/refcount/Makefile.am, tests/gobject/Makefile.am:
* glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am:
* glib/tests/Makefile.am, glib/pcre/Makefile.am:
* glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am:
* gthread/Makefile.am, glib/Makefile.am:
include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments.
* glib/tests/Makefile.am: removed example testing rules.
* glib/tests/testing.c: conditionalized performance and slow tests.
* glib/gtestutils.h:
* glib/gtestutils.c: work around g_test_config_vars not changing its
exported value after value assignments, aparently due to symbol aliases.
* glib/gtester.c: fixed off-by-one error which produced junk in logs.
* configure.in: check for python >= 2.4 and provide $PYTHON for scripts.
svn path=/trunk/; revision=5914
2007-11-21 21:09:46 +01:00
|
|
|
GLIB_VAR const GTestConfig * const g_test_config_vars;
|
2007-11-20 16:00:23 +01:00
|
|
|
|
2007-11-20 16:00:32 +01:00
|
|
|
/* internal logging API */
|
|
|
|
typedef enum {
|
|
|
|
G_TEST_LOG_NONE,
|
2007-12-21 14:58:42 +01:00
|
|
|
G_TEST_LOG_ERROR, /* s:msg */
|
|
|
|
G_TEST_LOG_START_BINARY, /* s:binaryname s:seed */
|
|
|
|
G_TEST_LOG_LIST_CASE, /* s:testpath */
|
|
|
|
G_TEST_LOG_SKIP_CASE, /* s:testpath */
|
|
|
|
G_TEST_LOG_START_CASE, /* s:testpath */
|
|
|
|
G_TEST_LOG_STOP_CASE, /* d:status d:nforks d:elapsed */
|
|
|
|
G_TEST_LOG_MIN_RESULT, /* s:blurb d:result */
|
|
|
|
G_TEST_LOG_MAX_RESULT, /* s:blurb d:result */
|
|
|
|
G_TEST_LOG_MESSAGE /* s:blurb */
|
2007-11-20 16:00:32 +01:00
|
|
|
} GTestLogType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
GTestLogType log_type;
|
|
|
|
guint n_strings;
|
2007-12-21 14:58:42 +01:00
|
|
|
gchar **strings; /* NULL terminated */
|
2007-11-20 16:00:32 +01:00
|
|
|
guint n_nums;
|
|
|
|
long double *nums;
|
|
|
|
} GTestLogMsg;
|
|
|
|
typedef struct {
|
|
|
|
/*< private >*/
|
|
|
|
GString *data;
|
|
|
|
GSList *msgs;
|
|
|
|
} GTestLogBuffer;
|
|
|
|
|
2007-11-20 16:00:45 +01:00
|
|
|
const char* g_test_log_type_name (GTestLogType log_type);
|
2007-11-20 16:00:32 +01:00
|
|
|
GTestLogBuffer* g_test_log_buffer_new (void);
|
|
|
|
void g_test_log_buffer_free (GTestLogBuffer *tbuffer);
|
|
|
|
void g_test_log_buffer_push (GTestLogBuffer *tbuffer,
|
|
|
|
guint n_bytes,
|
|
|
|
const guint8 *bytes);
|
|
|
|
GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer);
|
|
|
|
void g_test_log_msg_free (GTestLogMsg *tmsg);
|
2007-11-20 16:00:23 +01:00
|
|
|
|
2009-09-10 16:40:11 +02:00
|
|
|
/**
|
|
|
|
* GTestLogFatalFunc:
|
|
|
|
* @log_domain: the log domain of the message
|
|
|
|
* @log_level: the log level of the message (including the fatal and recursion flags)
|
|
|
|
* @message: the message to process
|
|
|
|
* @user_data: user data, set in g_test_log_set_fatal_handler()
|
|
|
|
*
|
|
|
|
* Specifies the prototype of fatal log handler functions.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the program should abort, %FALSE otherwise
|
|
|
|
*
|
|
|
|
* Since: 2.22
|
|
|
|
*/
|
|
|
|
typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer user_data);
|
|
|
|
void
|
|
|
|
g_test_log_set_fatal_handler (GTestLogFatalFunc log_func,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2007-12-21 14:58:42 +01:00
|
|
|
G_END_DECLS
|
2007-11-20 16:00:23 +01:00
|
|
|
|
2007-11-20 16:01:02 +01:00
|
|
|
#endif /* __G_TEST_UTILS_H__ */
|