gtestutils.h | gtestutils.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && ! defined (GLIB_COMPILATION) | #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && ! defined (GLIB_COMPILATION) | |||
#error "Only <glib.h> can be included directly." | #error "Only <glib.h> can be included directly." | |||
#endif | #endif | |||
#ifndef __G_TEST_UTILS_H__ | #ifndef __G_TEST_UTILS_H__ | |||
#define __G_TEST_UTILS_H__ | #define __G_TEST_UTILS_H__ | |||
#include <glib/gmessages.h> | #include <glib/gmessages.h> | |||
#include <glib/gstring.h> | #include <glib/gstring.h> | |||
#include <glib/gtypes.h> | ||||
#include <glib/gerror.h> | #include <glib/gerror.h> | |||
#include <glib/gslist.h> | #include <glib/gslist.h> | |||
G_BEGIN_DECLS | G_BEGIN_DECLS | |||
typedef struct GTestCase GTestCase; | typedef struct GTestCase GTestCase; | |||
typedef struct GTestSuite GTestSuite; | typedef struct GTestSuite GTestSuite; | |||
typedef void (*GTestFunc) (void); | ||||
typedef void (*GTestDataFunc) (gconstpointer user_data); | ||||
typedef void (*GTestFixtureFunc) (gpointer fixture, | ||||
gconstpointer user_data); | ||||
/* assertion API */ | /* assertion API */ | |||
#define g_assert_cmpstr(s1, cmp, s2) do { const char *__s1 = (s1), *__s2 = (s2); \ | #define g_assert_cmpstr(s1, cmp, s2) do { const char *__s1 = (s1), *__s2 = (s2); \ | |||
if (g_strcmp0 (__s1, __s2) cmp 0) ; else \ | if (g_strcmp0 (__s1, __s2) cmp 0) ; else \ | |||
g_assertion_message_cmpstr ( G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | g_assertion_message_cmpstr ( G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | |||
#s1 " " #cmp " " #s2, __s1 , #cmp, __s2); } while (0) | #s1 " " #cmp " " #s2, __s1 , #cmp, __s2); } while (0) | |||
#define g_assert_cmpint(n1, cmp, n2) do { gint64 __n1 = (n1), __n2 = (n2 ); \ | #define g_assert_cmpint(n1, cmp, n2) do { gint64 __n1 = (n1), __n2 = (n2 ); \ | |||
if (__n1 cmp __n2) ; else \ | if (__n1 cmp __n2) ; else \ | |||
g_assertion_message_cmpnum ( G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | g_assertion_message_cmpnum ( G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ | |||
#n1 " " #cmp " " #n2, __n1 , #cmp, __n2, 'i'); } while (0) | #n1 " " #cmp " " #n2, __n1 , #cmp, __n2, 'i'); } while (0) | |||
skipping to change at line 102 | skipping to change at line 105 | |||
#define g_test_quick() (g_test_config_vars->test_quick) | #define g_test_quick() (g_test_config_vars->test_quick) | |||
#define g_test_slow() (!g_test_config_vars->test_quick) | #define g_test_slow() (!g_test_config_vars->test_quick) | |||
#define g_test_thorough() (!g_test_config_vars->test_quick) | #define g_test_thorough() (!g_test_config_vars->test_quick) | |||
#define g_test_perf() (g_test_config_vars->test_perf) | #define g_test_perf() (g_test_config_vars->test_perf) | |||
#define g_test_verbose() (g_test_config_vars->test_verbose) | #define g_test_verbose() (g_test_config_vars->test_verbose) | |||
#define g_test_quiet() (g_test_config_vars->test_quiet) | #define g_test_quiet() (g_test_config_vars->test_quiet) | |||
/* run all tests under toplevel suite (path: /) */ | /* run all tests under toplevel suite (path: /) */ | |||
int g_test_run (void); | int g_test_run (void); | |||
/* hook up a test functions under test path */ | /* hook up a test functions under test path */ | |||
void g_test_add_func (const char *testpath, | void g_test_add_func (const char *testpath, | |||
void (*test_func) (void)) | GTestFunc test_func); | |||
; | ||||
void g_test_add_data_func (const char *testpath, | void g_test_add_data_func (const char *testpath, | |||
gconstpointer test_data, | gconstpointer test_data, | |||
void (*test_func) (gconst | GTestDataFunc test_func); | |||
pointer)); | ||||
/* hook up a test with fixture under test path */ | /* hook up a test with fixture under test path */ | |||
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \ | #define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \ | |||
G_STMT_START { \ | G_STMT_START { \ | |||
void (*add_vtable) (const char*, \ | void (*add_vtable) (const char*, \ | |||
gsize, \ | gsize, \ | |||
gconstpointer, \ | gconstpointer, \ | |||
void (*) (Fixture*, gco nstpointer), \ | void (*) (Fixture*, gco nstpointer), \ | |||
void (*) (Fixture*, gco nstpointer), \ | void (*) (Fixture*, gco nstpointer), \ | |||
void (*) (Fixture*, gco nstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (F ixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixt ure*, gconstpointer))) g_test_add_vtable; \ | void (*) (Fixture*, gco nstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (F ixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixt ure*, gconstpointer))) g_test_add_vtable; \ | |||
add_vtable \ | add_vtable \ | |||
skipping to change at line 162 | skipping to change at line 167 | |||
/* provide seed-able random numbers for tests */ | /* provide seed-able random numbers for tests */ | |||
#define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15 ))) | #define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15 ))) | |||
gint32 g_test_rand_int (void); | gint32 g_test_rand_int (void); | |||
gint32 g_test_rand_int_range (gint32 begin, | gint32 g_test_rand_int_range (gint32 begin, | |||
gint32 end); | gint32 end); | |||
double g_test_rand_double (void); | double g_test_rand_double (void); | |||
double g_test_rand_double_range (double range_start, | double g_test_rand_double_range (double range_start, | |||
double range_end); | double range_end); | |||
/* semi-internal API */ | /* semi-internal API */ | |||
GTestCase* g_test_create_case (const char *test_name, | GTestCase* g_test_create_case (const char *test_name, | |||
gsize data_size, | gsize data_size, | |||
gconstpointer test_data, | gconstpointer test_data, | |||
void (*data_setup) (void) | GTestFixtureFunc data_setup, | |||
, | GTestFixtureFunc data_test, | |||
void (*data_test) (void), | GTestFixtureFunc data_teardown); | |||
void (*data_teardown) (vo | GTestSuite* g_test_create_suite (const char *suite_name); | |||
id)); | ||||
GTestSuite* g_test_create_suite (const char *suite_name); | ||||
GTestSuite* g_test_get_root (void); | GTestSuite* g_test_get_root (void); | |||
void g_test_suite_add (GTestSuite *suite, | void g_test_suite_add (GTestSuite *suite, | |||
GTestCase *test_case); | GTestCase *test_case); | |||
void g_test_suite_add_suite (GTestSuite *suite, | void g_test_suite_add_suite (GTestSuite *suite, | |||
GTestSuite *nestedsuite); | GTestSuite *nestedsuite); | |||
int g_test_run_suite (GTestSuite *suite); | int g_test_run_suite (GTestSuite *suite); | |||
/* internal ABI */ | /* internal ABI */ | |||
void g_test_trap_assertions (const char *domain, | void g_test_trap_assertions (const char *domain, | |||
const char *file, | const char *file, | |||
skipping to change at line 215 | skipping to change at line 220 | |||
const char *expr, | const char *expr, | |||
long double arg1, | long double arg1, | |||
const char *cmp, | const char *cmp, | |||
long double arg2, | long double arg2, | |||
char numtype) G_GNUC_NO RETURN; | char numtype) G_GNUC_NO RETURN; | |||
void g_assertion_message_error (const char *domain, | void g_assertion_message_error (const char *domain, | |||
const char *file, | const char *file, | |||
int line, | int line, | |||
const char *func, | const char *func, | |||
const char *expr, | const char *expr, | |||
GError *error, | const GError *error, | |||
GQuark error_domain, | GQuark error_domain, | |||
int error_code) G_GNUC _NORETURN; | int error_code) G_GNUC _NORETURN; | |||
void g_test_add_vtable (const char *testpath, | void g_test_add_vtable (const char *testpath, | |||
gsize data_size, | gsize data_size, | |||
gconstpointer test_data, | gconstpointer test_data, | |||
void (*data_setup) (vo | GTestFixtureFunc data_setup, | |||
id), | GTestFixtureFunc data_test, | |||
void (*data_test) (vo | GTestFixtureFunc data_teardown); | |||
id), | ||||
void (*data_teardown) (vo | ||||
id)); | ||||
typedef struct { | typedef struct { | |||
gboolean test_initialized; | gboolean test_initialized; | |||
gboolean test_quick; /* disable thorough tests */ | gboolean test_quick; /* disable thorough tests */ | |||
gboolean test_perf; /* run performance tests */ | gboolean test_perf; /* run performance tests */ | |||
gboolean test_verbose; /* extra info */ | gboolean test_verbose; /* extra info */ | |||
gboolean test_quiet; /* reduce output */ | gboolean test_quiet; /* reduce output */ | |||
} GTestConfig; | } GTestConfig; | |||
GLIB_VAR const GTestConfig * const g_test_config_vars; | GLIB_VAR const GTestConfig * const g_test_config_vars; | |||
/* internal logging API */ | /* internal logging API */ | |||
End of changes. 7 change blocks. | ||||
21 lines changed or deleted | 19 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |