From 10806a1d95603965aa1071e9d32a7456c18abe26 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 27 Sep 2016 08:25:58 +0200 Subject: [PATCH] add a failing test for bug 2234 --- src/economy.test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/economy.test.c b/src/economy.test.c index fbcc720bc..c1459544e 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -246,6 +246,7 @@ static void test_maintain_buildings(CuTest *tc) { building *b; building_type *btype; unit *u; + faction *f; maintenance *req; item_type *itype; @@ -253,7 +254,8 @@ static void test_maintain_buildings(CuTest *tc) { btype = test_create_buildingtype("Hort"); btype->maxsize = 10; 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); itype = test_create_itemtype("money"); b->size = btype->maxsize; @@ -263,6 +265,7 @@ static void test_maintain_buildings(CuTest *tc) { b->flags = 0; maintain_buildings(r); CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED)); + CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "maintenance_nowork")); req = calloc(2, sizeof(maintenance)); req[0].number = 100; @@ -273,6 +276,8 @@ static void test_maintain_buildings(CuTest *tc) { b->flags = 0; maintain_buildings(r); 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: i_change(&u->items, itype, 100); @@ -286,6 +291,8 @@ 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")); + CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner")); test_cleanup(); }