forked from github/server
add a failing test for bug 2234
This commit is contained in:
parent
42c44724f8
commit
10806a1d95
1 changed files with 8 additions and 1 deletions
|
@ -246,6 +246,7 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
building *b;
|
building *b;
|
||||||
building_type *btype;
|
building_type *btype;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
faction *f;
|
||||||
maintenance *req;
|
maintenance *req;
|
||||||
item_type *itype;
|
item_type *itype;
|
||||||
|
|
||||||
|
@ -253,7 +254,8 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
btype = test_create_buildingtype("Hort");
|
btype = test_create_buildingtype("Hort");
|
||||||
btype->maxsize = 10;
|
btype->maxsize = 10;
|
||||||
r = test_create_region(0, 0, 0);
|
r = test_create_region(0, 0, 0);
|
||||||
u = test_create_unit(test_create_faction(0), r);
|
f = test_create_faction(0);
|
||||||
|
u = test_create_unit(f, r);
|
||||||
b = test_create_building(r, btype);
|
b = test_create_building(r, btype);
|
||||||
itype = test_create_itemtype("money");
|
itype = test_create_itemtype("money");
|
||||||
b->size = btype->maxsize;
|
b->size = btype->maxsize;
|
||||||
|
@ -263,6 +265,7 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
b->flags = 0;
|
b->flags = 0;
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
||||||
|
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "maintenance_nowork"));
|
||||||
|
|
||||||
req = calloc(2, sizeof(maintenance));
|
req = calloc(2, sizeof(maintenance));
|
||||||
req[0].number = 100;
|
req[0].number = 100;
|
||||||
|
@ -273,6 +276,8 @@ 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));
|
||||||
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "maintenance_nowork"));
|
||||||
|
CuAssertPtrEquals(tc, 0, test_find_messagetype(r->msgs, "maintenance_noowner"));
|
||||||
|
|
||||||
// we can afford to pay:
|
// we can afford to pay:
|
||||||
i_change(&u->items, itype, 100);
|
i_change(&u->items, itype, 100);
|
||||||
|
@ -286,6 +291,8 @@ 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"));
|
||||||
|
CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner"));
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue