forked from github/server
increase error-logging from unit tests.
suppress some unrelated errors.
This commit is contained in:
parent
e516f2d630
commit
729c4ceea1
|
@ -90,7 +90,7 @@ struct message *msg_feedback(const struct unit *u, struct order *ord,
|
|||
ord = u->thisorder;
|
||||
|
||||
if (!mtype) {
|
||||
log_error("trying to create message of unknown type \"%s\"\n", name);
|
||||
log_warning("trying to create message of unknown type \"%s\"\n", name);
|
||||
if (!mt_find("missing_feedback")) {
|
||||
mt_register(mt_new_va("missing_feedback", "unit:unit", "region:region", "command:order", "name:string", 0));
|
||||
}
|
||||
|
|
|
@ -1229,6 +1229,8 @@ static void test_show_without_item(CuTest *tc)
|
|||
test_cleanup();
|
||||
|
||||
loc = get_or_create_locale("de");
|
||||
locale_setstring(loc, parameters[P_ANY], "ALLE");
|
||||
init_parameters(loc);
|
||||
|
||||
r = test_create_region(0, 0, test_create_terrain("testregion", LAND_REGION));
|
||||
f = test_create_faction(test_create_race("human"));
|
||||
|
|
|
@ -100,7 +100,7 @@ static void test_sabotage_self(CuTest *tc) {
|
|||
order *ord;
|
||||
|
||||
setup_sabotage();
|
||||
r = test_create_region(0, 0, NULL);
|
||||
r = findregion(0, 0);
|
||||
assert(r);
|
||||
u = test_create_unit(test_create_faction(NULL), r);
|
||||
assert(u && u->faction && u->region == r);
|
||||
|
@ -122,7 +122,7 @@ static void test_sabotage_other_fail(CuTest *tc) {
|
|||
message *msg;
|
||||
|
||||
setup_sabotage();
|
||||
r = test_create_region(0, 0, NULL);
|
||||
r = findregion(0, 0);
|
||||
assert(r);
|
||||
u = test_create_unit(test_create_faction(NULL), r);
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
|
@ -151,7 +151,7 @@ static void test_sabotage_other_success(CuTest *tc) {
|
|||
order *ord;
|
||||
|
||||
setup_sabotage();
|
||||
r = test_create_region(0, 0, NULL);
|
||||
r = findregion(0, 0);
|
||||
assert(r);
|
||||
u = test_create_unit(test_create_faction(NULL), r);
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <kernel/unit.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/region.h>
|
||||
#include <util/message.h>
|
||||
#include <util/language.h>
|
||||
#include <util/base36.h>
|
||||
|
@ -29,7 +30,7 @@ static void setup_study(study_fixture *fix, skill_t sk) {
|
|||
test_cleanup();
|
||||
config_set("study.random_progress", "0");
|
||||
test_create_world();
|
||||
r = test_create_region(0, 0, 0);
|
||||
r = findregion(0, 0);
|
||||
f = test_create_faction(0);
|
||||
lang = get_or_create_locale(locale_name(f->locale));
|
||||
locale_setstring(lang, mkname("skill", skillnames[sk]), skillnames[sk]);
|
||||
|
|
|
@ -156,7 +156,7 @@ int RunAllTests(int argc, char *argv[])
|
|||
}
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
log_stderr = 0;
|
||||
log_stderr = LOG_CPERROR|LOG_FLUSH;
|
||||
++argv;
|
||||
--argc;
|
||||
if (argc > 0 && strcmp("--list", argv[0]) == 0) {
|
||||
|
|
15
src/tests.c
15
src/tests.c
|
@ -45,14 +45,19 @@ struct race *test_create_race(const char *name)
|
|||
|
||||
struct region *test_create_region(int x, int y, const terrain_type *terrain)
|
||||
{
|
||||
region *r = new_region(x, y, NULL, 0);
|
||||
region *r = findregion(x, y);
|
||||
if (!r) {
|
||||
r = new_region(x, y, NULL, 0);
|
||||
}
|
||||
if (!terrain) {
|
||||
terrain_type *t = get_or_create_terrain("plain");
|
||||
t->size = 1000;
|
||||
fset(t, LAND_REGION|CAVALRY_REGION|FOREST_REGION);
|
||||
terraform_region(r, t);
|
||||
} else
|
||||
}
|
||||
else {
|
||||
terraform_region(r, terrain);
|
||||
}
|
||||
rsettrees(r, 0, 0);
|
||||
rsettrees(r, 1, 0);
|
||||
rsettrees(r, 2, 0);
|
||||
|
@ -255,6 +260,11 @@ void test_create_world(void)
|
|||
struct locale * loc;
|
||||
|
||||
loc = get_or_create_locale("de");
|
||||
|
||||
locale_setstring(loc, parameters[P_SHIP], "SCHIFF");
|
||||
locale_setstring(loc, parameters[P_ANY], "ALLE");
|
||||
init_parameters(loc);
|
||||
|
||||
locale_setstring(loc, keyword(K_RESERVE), "RESERVIEREN");
|
||||
locale_setstring(loc, "money", "SILBER");
|
||||
init_resources();
|
||||
|
@ -270,6 +280,7 @@ void test_create_world(void)
|
|||
test_create_itemtype("iron");
|
||||
test_create_itemtype("stone");
|
||||
|
||||
|
||||
t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO);
|
||||
t_plain->size = 1000;
|
||||
t_plain->max_road = 100;
|
||||
|
|
Loading…
Reference in New Issue