forked from github/server
provide more missing messages in test setups.
This commit is contained in:
parent
b432fbe9d8
commit
787abc90cf
9 changed files with 21 additions and 12 deletions
|
@ -468,7 +468,7 @@
|
|||
<text locale="de">"Die Ausrüstung von $unit($unit) scheint unsichtbar. ($int36($id))"</text>
|
||||
<text locale="en">"$unit($unit)'s equipment is invisible. ($int36($id))"</text>
|
||||
</message>
|
||||
<message name="curseinfo::magicresistance_unit" section="events">
|
||||
<message name="magicresistance_unit" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="id" type="int"/>
|
||||
|
@ -476,7 +476,7 @@
|
|||
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
|
||||
<text locale="en">"The magical resistance has been strengthened. ($int36($id))"</text>
|
||||
</message>
|
||||
<message name="curseinfo::magicresistance_building" section="events">
|
||||
<message name="magicresistance_building" section="events">
|
||||
<type>
|
||||
<arg name="building" type="building"/>
|
||||
<arg name="id" type="int"/>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/region.h>
|
||||
#include <util/message.h>
|
||||
#include <tests.h>
|
||||
|
||||
#include <CuTest.h>
|
||||
|
@ -12,6 +13,7 @@ static void test_add_donation(CuTest *tc) {
|
|||
region *r;
|
||||
|
||||
test_setup();
|
||||
mt_register(mt_new_va("donation", "from:faction", "to:faction", "amount:int", NULL));
|
||||
r = test_create_region(0, 0, NULL);
|
||||
f1 = test_create_faction(NULL);
|
||||
f2 = test_create_faction(NULL);
|
||||
|
|
|
@ -369,7 +369,8 @@ static void test_tax_cmd(CuTest *tc) {
|
|||
test_teardown();
|
||||
}
|
||||
|
||||
static void setup_maintenance(void) {
|
||||
static void setup_economy(void) {
|
||||
mt_register(mt_new_va("recruit", "unit:unit", "region:region", "amount:int", "want:int", NULL));
|
||||
mt_register(mt_new_va("maintenance", "unit:unit", "building:building", NULL));
|
||||
mt_register(mt_new_va("maintenancefail", "unit:unit", "building:building", NULL));
|
||||
mt_register(mt_new_va("maintenance_nowork", "building:building", NULL));
|
||||
|
@ -389,7 +390,7 @@ static void test_maintain_buildings(CuTest *tc) {
|
|||
item_type *itype;
|
||||
|
||||
test_setup();
|
||||
setup_maintenance();
|
||||
setup_economy();
|
||||
btype = test_create_buildingtype("Hort");
|
||||
btype->maxsize = 10;
|
||||
r = test_create_region(0, 0, NULL);
|
||||
|
@ -449,6 +450,7 @@ static void test_recruit(CuTest *tc) {
|
|||
faction *f;
|
||||
|
||||
test_setup();
|
||||
setup_economy();
|
||||
f = test_create_faction(NULL);
|
||||
u = test_create_unit(f, test_create_region(0, 0, NULL));
|
||||
CuAssertIntEquals(tc, 1, u->number);
|
||||
|
|
|
@ -11,6 +11,7 @@ void test_missing_message(CuTest *tc) {
|
|||
message *msg;
|
||||
|
||||
test_setup();
|
||||
message_handle_missing(MESSAGE_MISSING_REPLACE);
|
||||
msg = msg_message("unknown", "unit", NULL);
|
||||
CuAssertPtrNotNull(tc, msg);
|
||||
CuAssertPtrNotNull(tc, msg->type);
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
#include <kernel/region.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <util/language.h>
|
||||
#include <util/attrib.h>
|
||||
#include <util/language.h>
|
||||
#include <util/message.h>
|
||||
#include <spells/regioncurse.h>
|
||||
|
||||
#include <attributes/attributes.h>
|
||||
|
@ -121,6 +122,8 @@ static void test_view_reality(CuTest *tc) {
|
|||
castorder co;
|
||||
|
||||
test_setup();
|
||||
mt_register(mt_new_va("spell_astral_only", "unit:unit", "region:region", "command:order", NULL));
|
||||
mt_register(mt_new_va("viewreality_effect", "unit:unit", NULL));
|
||||
r = test_create_region(0, 0, NULL);
|
||||
ra = test_create_region(real2tp(r->x), real2tp(r->y), NULL);
|
||||
ra->_plane = get_astralplane();
|
||||
|
|
|
@ -10,14 +10,14 @@ static struct message *cinfo_magicresistance(const void *obj, objtype_t typ, con
|
|||
if (typ == TYP_UNIT) {
|
||||
if (self != 0) {
|
||||
const struct unit *u = (const struct unit *)obj;
|
||||
return msg_message(mkname("curseinfo", "magicresistance_unit"), "unit id", u,
|
||||
return msg_message("magicresistance_unit", "unit id", u,
|
||||
c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if (typ == TYP_BUILDING) {
|
||||
const struct building *b = (const struct building *)obj;
|
||||
return msg_message(mkname("curseinfo", "magicresistance_building"), "id building", c->no, b);
|
||||
return msg_message("magicresistance_building", "id building", c->no, b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ static void test_magicresistance_unit(CuTest *tc) {
|
|||
curse *c;
|
||||
|
||||
test_setup();
|
||||
mt_register(mt_new_va("magicresistance_unit", "unit:unit", "id:int", NULL));
|
||||
r = test_create_plain(0, 0);
|
||||
f1 = test_create_faction(NULL);
|
||||
u1 = test_create_unit(f1, r);
|
||||
|
@ -41,7 +42,7 @@ static void test_magicresistance_unit(CuTest *tc) {
|
|||
CuAssertPtrEquals(tc, (void *)&at_curse, (void *)u2->attribs->type);
|
||||
msg = c->type->curseinfo(u2, TYP_UNIT, c, 1);
|
||||
CuAssertPtrNotNull(tc, msg);
|
||||
CuAssertStrEquals(tc, "curseinfo::magicresistance_unit", test_get_messagetype(msg));
|
||||
CuAssertStrEquals(tc, "magicresistance_unit", test_get_messagetype(msg));
|
||||
msg_release(msg);
|
||||
|
||||
test_teardown();
|
||||
|
@ -56,6 +57,7 @@ static void test_magicresistance_building(CuTest *tc) {
|
|||
curse *c;
|
||||
|
||||
test_setup();
|
||||
mt_register(mt_new_va("magicresistance_building", "building:building", "id:int", NULL));
|
||||
r = test_create_plain(0, 0);
|
||||
f1 = test_create_faction(NULL);
|
||||
u1 = test_create_unit(f1, r);
|
||||
|
@ -67,7 +69,7 @@ static void test_magicresistance_building(CuTest *tc) {
|
|||
CuAssertPtrEquals(tc, (void *)&at_curse, (void *)b1->attribs->type);
|
||||
msg = c->type->curseinfo(b1, TYP_BUILDING, c, 1);
|
||||
CuAssertPtrNotNull(tc, msg);
|
||||
CuAssertStrEquals(tc, "curseinfo::magicresistance_building", test_get_messagetype(msg));
|
||||
CuAssertStrEquals(tc, "magicresistance_building", test_get_messagetype(msg));
|
||||
msg_release(msg);
|
||||
test_teardown();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <eressea.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/database.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <CuTest.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -185,6 +184,5 @@ int main(int argc, char ** argv) {
|
|||
++argv;
|
||||
--argc;
|
||||
}
|
||||
message_handle_missing(MESSAGE_MISSING_REPLACE);
|
||||
return RunAllTests(argc, argv);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <kernel/config.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/terrain.h>
|
||||
|
@ -22,7 +23,6 @@
|
|||
#include <kernel/spell.h>
|
||||
#include <kernel/spellbook.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/language.h>
|
||||
#include <util/lists.h>
|
||||
|
@ -245,6 +245,7 @@ static void test_reset(void) {
|
|||
void test_setup_test(CuTest *tc, const char *file, int line) {
|
||||
test_log_stderr(LOG_CPERROR);
|
||||
test_reset();
|
||||
message_handle_missing(MESSAGE_MISSING_ERROR);
|
||||
if (tc) {
|
||||
log_debug("start test: %s", tc->name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue