forked from github/server
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:
parent
f2d0d74e70
commit
fc6ab724a5
|
@ -286,6 +286,9 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
||||||
CuAssertIntEquals(tc, 0, i_get(u->items, itype));
|
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);
|
test_clear_messages(f);
|
||||||
|
|
||||||
// this building has no owner, it doesn't work:
|
// this building has no owner, it doesn't work:
|
||||||
|
@ -293,7 +296,7 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
b->flags = 0;
|
b->flags = 0;
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, 0, fval(b, BLD_MAINTAINED));
|
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"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner"));
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
|
@ -452,6 +452,14 @@ struct message * test_find_messagetype(struct message_list *msgs, const char *na
|
||||||
return test_find_messagetype_ex(msgs, name, NULL);
|
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) {
|
void test_clear_messages(faction *f) {
|
||||||
if (f->msgs) {
|
if (f->msgs) {
|
||||||
free_messagelist(f->msgs->begin);
|
free_messagelist(f->msgs->begin);
|
||||||
|
|
|
@ -61,6 +61,7 @@ extern "C" {
|
||||||
struct message * test_find_messagetype(struct message_list *msgs, const char *name);
|
struct message * test_find_messagetype(struct message_list *msgs, const char *name);
|
||||||
struct message * test_get_last_message(struct message_list *mlist);
|
struct message * test_get_last_message(struct message_list *mlist);
|
||||||
void test_clear_messages(struct faction *f);
|
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_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_pointer_parameter(struct CuTest * tc, struct message *msg, int index, void *arg);
|
||||||
|
|
Loading…
Reference in New Issue