re-enable report testing, find out that it fails.

This commit is contained in:
Enno Rehling 2016-09-16 21:17:54 +02:00
parent 74ff763b22
commit a86e30d014
3 changed files with 15 additions and 3 deletions

View File

@ -1311,7 +1311,7 @@ void prepare_report(report_context *ctx, faction *f)
static bool rule_region_owners; static bool rule_region_owners;
const struct building_type *bt_lighthouse = bt_find("lighthouse"); const struct building_type *bt_lighthouse = bt_find("lighthouse");
if (config_changed(&config)) { if (bt_lighthouse && config_changed(&config)) {
rule_region_owners = config_token("rules.region_owner_pay_building", bt_lighthouse->_name); rule_region_owners = config_token("rules.region_owner_pay_building", bt_lighthouse->_name);
} }

View File

@ -225,12 +225,13 @@ static void test_arg_resources(CuTest *tc) {
static void test_prepare_travelthru(CuTest *tc) { static void test_prepare_travelthru(CuTest *tc) {
report_context ctx; report_context ctx;
faction *f; faction *f, *f2;
region *r1, *r2, *r3; region *r1, *r2, *r3;
unit *u; unit *u;
test_setup(); test_setup();
f = test_create_faction(0); f = test_create_faction(0);
f2 = test_create_faction(0);
r1 = test_create_region(0, 0, 0); r1 = test_create_region(0, 0, 0);
r2 = test_create_region(1, 0, 0); r2 = test_create_region(1, 0, 0);
r3 = test_create_region(2, 0, 0); r3 = test_create_region(2, 0, 0);
@ -239,9 +240,18 @@ static void test_prepare_travelthru(CuTest *tc) {
prepare_report(&ctx, f); prepare_report(&ctx, f);
CuAssertPtrEquals(tc, r1, ctx.first); CuAssertPtrEquals(tc, r1, ctx.first);
CuAssertPtrEquals(tc, r3, ctx.last); CuAssertPtrEquals(tc, r3, ctx.last);
CuAssertPtrEquals(tc, f, ctx.f);
CuAssertIntEquals(tc, seen_unit, r1->seen.mode); CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
CuAssertIntEquals(tc, seen_travel, r2->seen.mode); CuAssertIntEquals(tc, seen_travel, r2->seen.mode);
CuAssertIntEquals(tc, seen_none, r3->seen.mode); CuAssertIntEquals(tc, seen_none, r3->seen.mode);
finish_reports(&ctx);
CuAssertIntEquals(tc, seen_none, r2->seen.mode);
prepare_report(&ctx, f2);
CuAssertIntEquals(tc, seen_none, r2->seen.mode);
CuAssertPtrEquals(tc, f2, ctx.f);
CuAssertPtrEquals(tc, NULL, ctx.first);
CuAssertPtrEquals(tc, NULL, ctx.last);
test_cleanup(); test_cleanup();
} }

View File

@ -99,7 +99,7 @@ int RunAllTests(int argc, char *argv[])
ADD_SUITE(item); ADD_SUITE(item);
ADD_SUITE(magic); ADD_SUITE(magic);
ADD_SUITE(alchemy); ADD_SUITE(alchemy);
// ADD_SUITE(reports); ADD_SUITE(reports);
ADD_SUITE(save); ADD_SUITE(save);
ADD_SUITE(ship); ADD_SUITE(ship);
ADD_SUITE(spellbook); ADD_SUITE(spellbook);
@ -110,6 +110,8 @@ int RunAllTests(int argc, char *argv[])
ADD_SUITE(ally); ADD_SUITE(ally);
ADD_SUITE(messages); ADD_SUITE(messages);
/* gamecode */ /* gamecode */
ADD_SUITE(report);
// ADD_SUITE(creport);
ADD_SUITE(prefix); ADD_SUITE(prefix);
ADD_SUITE(summary); ADD_SUITE(summary);
ADD_SUITE(names); ADD_SUITE(names);