medit/moo/mooutils/moo-test-utils.h

94 lines
4.0 KiB
C
Raw Normal View History

/*
* moo-test-utils.h
*
2010-12-21 20:15:45 -08:00
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
*
* This file is part of medit. medit 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.1 of the License,
* or (at your option) any later version.
*
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
2008-01-31 01:16:57 -06:00
#ifndef MOO_TEST_UTILS_H
#define MOO_TEST_UTILS_H
#include <mooglib/moo-glib.h>
2008-01-31 01:16:57 -06:00
#include <string.h>
#include <stdarg.h>
2009-11-24 20:57:57 -08:00
#include <mooutils/mooutils-macros.h>
2009-12-06 13:53:50 -08:00
#include <mooutils/mooutils-misc.h>
2008-01-31 01:16:57 -06:00
G_BEGIN_DECLS
typedef struct {
gpointer suite_data;
gpointer test_data;
} MooTestEnv;
2008-05-05 10:13:42 -05:00
typedef enum {
MOO_TEST_LIST_ONLY = 1 << 0,
2011-01-02 01:41:49 -08:00
MOO_TEST_FATAL_ERROR = 1 << 1,
MOO_TEST_INSTALLED = 1 << 2
2008-05-05 10:13:42 -05:00
} MooTestOptions;
2008-01-31 01:16:57 -06:00
typedef struct MooTestSuite MooTestSuite;
typedef gboolean (*MooTestSuiteInit) (gpointer data);
typedef void (*MooTestSuiteCleanup) (gpointer data);
typedef void (*MooTestFunc) (MooTestEnv *env);
MooTestSuite *moo_test_suite_new (const char *name,
const char *description,
2008-01-31 01:16:57 -06:00
MooTestSuiteInit init_func,
MooTestSuiteCleanup cleanup_func,
gpointer data);
void moo_test_suite_add_test (MooTestSuite *ts,
const char *name,
const char *description,
2008-01-31 01:16:57 -06:00
MooTestFunc test_func,
gpointer data);
2011-01-02 01:41:49 -08:00
gboolean moo_test_run_tests (char **tests,
const char *coverage_file,
2008-05-05 10:13:42 -05:00
MooTestOptions opts);
2008-01-31 01:16:57 -06:00
void moo_test_cleanup (void);
gboolean moo_test_get_result (void);
void moo_test_assert_impl (gboolean passed,
const char *text,
const char *filename,
int line);
void moo_test_assert_msgv (gboolean passed,
const char *file,
int line,
const char *format,
2013-12-05 16:23:46 -08:00
va_list args) G_GNUC_PRINTF(4, 0);
2008-01-31 01:16:57 -06:00
void moo_test_assert_msg (gboolean passed,
const char *file,
int line,
const char *format,
2013-12-05 16:23:46 -08:00
...) G_GNUC_PRINTF(4, 5);
2008-01-31 01:16:57 -06:00
2008-02-10 12:56:31 -06:00
char *moo_test_load_data_file (const char *basename);
2011-01-01 18:53:27 -08:00
char *moo_test_find_data_file (const char *basename);
2011-01-02 01:41:49 -08:00
void moo_test_set_data_dir (const char *dir);
2008-02-10 12:56:31 -06:00
const char *moo_test_get_data_dir (void);
const char *moo_test_get_working_dir (void);
2011-01-02 01:41:49 -08:00
char **moo_test_list_data_files (const char *subdir);
void moo_test_coverage_enable (void);
void moo_test_coverage_write (const char *filename);
2011-01-09 23:33:47 -08:00
void moo_test_coverage_record (const char *lang,
const char *function);
2008-02-10 12:56:31 -06:00
2011-01-22 01:31:21 -08:00
gboolean moo_test_set_silent_messages (gboolean silent);
2008-01-31 01:16:57 -06:00
G_END_DECLS
#endif /* MOO_TEST_UTILS_H */