2012-06-04 11:35:56 +02:00
|
|
|
#ifndef ERESSEA_TESTS_H
|
|
|
|
#define ERESSEA_TESTS_H
|
2014-10-18 14:16:26 +02:00
|
|
|
|
2014-12-17 19:53:19 +01:00
|
|
|
#include <kernel/types.h>
|
2014-10-18 14:16:26 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2014-04-12 04:20:20 +02:00
|
|
|
|
2015-11-15 02:20:55 +01:00
|
|
|
#define ASSERT_DBL_DELTA 0.001
|
|
|
|
|
2014-10-18 14:30:07 +02:00
|
|
|
struct region;
|
|
|
|
struct unit;
|
|
|
|
struct faction;
|
|
|
|
struct building;
|
|
|
|
struct ship;
|
2015-01-12 18:31:04 +01:00
|
|
|
struct message;
|
2015-01-13 07:43:30 +01:00
|
|
|
struct message_list;
|
2015-02-01 19:14:06 +01:00
|
|
|
struct mlist;
|
2014-10-18 14:30:07 +02:00
|
|
|
struct item_type;
|
|
|
|
struct building_type;
|
2014-10-18 17:12:43 +02:00
|
|
|
struct ship_type;
|
2014-10-18 14:30:07 +02:00
|
|
|
struct terrain_type;
|
2015-11-02 17:09:16 +01:00
|
|
|
struct castorder;
|
|
|
|
struct spellparameter;
|
2015-11-12 19:34:25 +01:00
|
|
|
struct spell;
|
2016-03-23 11:56:17 +01:00
|
|
|
struct locale;
|
2016-08-29 16:19:17 +02:00
|
|
|
struct strlist;
|
|
|
|
struct log_t;
|
2014-10-18 14:30:07 +02:00
|
|
|
|
2015-02-01 19:14:06 +01:00
|
|
|
struct CuTest;
|
|
|
|
|
2016-11-16 18:08:10 +01:00
|
|
|
void test_setup_test(struct CuTest *tc, const char *file, int line);
|
|
|
|
#define test_setup() test_setup_test(NULL, __FILE__, __LINE__)
|
|
|
|
#define test_setup_ex(tc) test_setup_test(tc, __FILE__, __LINE__)
|
|
|
|
|
2014-10-18 14:16:26 +02:00
|
|
|
void test_cleanup(void);
|
2016-08-29 15:09:47 +02:00
|
|
|
void test_log_stderr(int on);
|
2016-08-29 16:19:17 +02:00
|
|
|
struct log_t * test_log_start(int flags, struct strlist **slist);
|
|
|
|
void test_log_stop(struct log_t *log, struct strlist *slist);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2016-03-23 11:56:17 +01:00
|
|
|
struct locale * test_create_locale(void);
|
2014-10-18 14:16:26 +02:00
|
|
|
struct terrain_type * test_create_terrain(const char * name, unsigned int flags);
|
|
|
|
struct race *test_create_race(const char *name);
|
|
|
|
struct region *test_create_region(int x, int y,
|
|
|
|
const struct terrain_type *terrain);
|
|
|
|
struct faction *test_create_faction(const struct race *rc);
|
|
|
|
struct unit *test_create_unit(struct faction *f, struct region *r);
|
|
|
|
void test_create_world(void);
|
2015-11-07 23:34:51 +01:00
|
|
|
struct item_type * test_create_horse(void);
|
2014-10-18 14:16:26 +02:00
|
|
|
struct building * test_create_building(struct region * r, const struct building_type * btype);
|
|
|
|
struct ship * test_create_ship(struct region * r, const struct ship_type * stype);
|
|
|
|
struct item_type * test_create_itemtype(const char * name);
|
|
|
|
struct ship_type *test_create_shiptype(const char * name);
|
|
|
|
struct building_type *test_create_buildingtype(const char *name);
|
2015-11-02 17:09:16 +01:00
|
|
|
void test_create_castorder(struct castorder *co, struct unit *u, int level, float force, int range, struct spellparameter *par);
|
2015-11-12 19:34:25 +01:00
|
|
|
struct spell * test_create_spell(void);
|
2012-07-02 03:00:31 +02:00
|
|
|
|
2014-10-18 14:16:26 +02:00
|
|
|
int RunAllTests(void);
|
2014-12-17 19:53:19 +01:00
|
|
|
void test_translate_param(const struct locale *lang, param_t param, const char *text);
|
2015-01-12 17:50:10 +01:00
|
|
|
const char * test_get_messagetype(const struct message *msg);
|
2016-08-28 11:05:34 +02:00
|
|
|
struct message * test_find_messagetype_ex(struct message_list *msgs, const char *name, struct message *prev);
|
2015-08-15 20:25:36 +02:00
|
|
|
struct message * test_find_messagetype(struct message_list *msgs, const char *name);
|
2015-01-13 07:43:30 +01:00
|
|
|
struct message * test_get_last_message(struct message_list *mlist);
|
2015-10-12 13:27:39 +02:00
|
|
|
void test_clear_messages(struct faction *f);
|
2016-09-27 15:40:03 +02:00
|
|
|
void test_clear_messagelist(struct message_list **msgs);
|
2016-06-11 13:47:38 +02:00
|
|
|
void assert_message(struct CuTest * tc, struct message *msg, char *name, int numpar);
|
|
|
|
|
|
|
|
void assert_pointer_parameter(struct CuTest * tc, struct message *msg, int index, void *arg);
|
|
|
|
void assert_int_parameter(struct CuTest * tc, struct message *msg, int index, int arg);
|
|
|
|
void assert_string_parameter(struct CuTest * tc, struct message *msg, int index, const char *arg);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2015-02-08 13:42:04 +01:00
|
|
|
void disabled_test(void *suite, void (*)(struct CuTest *), const char *name);
|
2015-02-08 13:37:44 +01:00
|
|
|
|
2015-02-08 13:42:04 +01:00
|
|
|
#define DISABLE_TEST(SUITE, TEST) disabled_test(SUITE, TEST, #TEST)
|
2015-02-08 13:37:44 +01:00
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-04 11:35:56 +02:00
|
|
|
#endif
|