fix the economy test. no idea why it passes now?

this doesn't represent the bug 2234 that I am trying to repro, yet.
This commit is contained in:
Enno Rehling 2016-09-27 15:40:03 +02:00
parent f2d0d74e70
commit fc6ab724a5
3 changed files with 13 additions and 1 deletions

View File

@ -286,6 +286,9 @@ static void test_maintain_buildings(CuTest *tc) {
maintain_buildings(r);
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
CuAssertIntEquals(tc, 0, i_get(u->items, itype));
CuAssertPtrEquals(tc, 0, r->msgs);
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "maintenance_nowork"));
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "maintenance"));
test_clear_messages(f);
// this building has no owner, it doesn't work:
@ -293,7 +296,7 @@ static void test_maintain_buildings(CuTest *tc) {
b->flags = 0;
maintain_buildings(r);
CuAssertIntEquals(tc, 0, fval(b, BLD_MAINTAINED));
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "maintenance_nowork"));
CuAssertPtrEquals(tc, 0, f->msgs);
CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner"));
test_cleanup();

View File

@ -452,6 +452,14 @@ struct message * test_find_messagetype(struct message_list *msgs, const char *na
return test_find_messagetype_ex(msgs, name, NULL);
}
void test_clear_messagelist(message_list **msgs) {
if (*msgs) {
free_messagelist((*msgs)->begin);
free(*msgs);
*msgs = NULL;
}
}
void test_clear_messages(faction *f) {
if (f->msgs) {
free_messagelist(f->msgs->begin);

View File

@ -61,6 +61,7 @@ extern "C" {
struct message * test_find_messagetype(struct message_list *msgs, const char *name);
struct message * test_get_last_message(struct message_list *mlist);
void test_clear_messages(struct faction *f);
void test_clear_messagelist(struct message_list **msgs);
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);