diff --git a/src/economy.test.c b/src/economy.test.c index e14b473b4..7534afe7e 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -128,12 +128,9 @@ static struct unit *create_recruiter(void) { unit *u; const resource_type* rtype; - test_cleanup(); - test_create_world(); - - r=findregion(0, 0); + r=test_create_region(0, 0, NULL); rsetpeasants(r, 999); - f = test_create_faction(rc_find("human")); + f = test_create_faction(NULL); u = test_create_unit(f, r); rtype = get_resourcetype(R_SILVER); change_resource(u, rtype, 1000); @@ -143,9 +140,10 @@ static struct unit *create_recruiter(void) { static void test_heroes_dont_recruit(CuTest * tc) { unit *u; - test_cleanup(); - + test_setup(); + init_resources(); u = create_recruiter(); + fset(u, UFL_HERO); unit_addorder(u, create_order(K_RECRUIT, default_locale, "1")); @@ -160,8 +158,8 @@ static void test_heroes_dont_recruit(CuTest * tc) { static void test_normals_recruit(CuTest * tc) { unit *u; - test_cleanup(); - + test_setup(); + init_resources(); u = create_recruiter(); unit_addorder(u, create_order(K_RECRUIT, default_locale, "1")); @@ -193,11 +191,11 @@ static void test_tax_cmd(CuTest *tc) { request *taxorders = 0; - test_cleanup(); + test_setup(); + init_resources(); config_set("taxing.perlevel", "20"); - test_create_world(); f = test_create_faction(NULL); - r = findregion(0, 0); + r = test_create_region(0, 0, NULL); assert(r && f); u = test_create_unit(f, r); @@ -210,7 +208,7 @@ static void test_tax_cmd(CuTest *tc) { silver = get_resourcetype(R_SILVER)->itype; - sword = it_get_or_create(rt_get_or_create("sword")); + sword = test_create_itemtype("sword"); new_weapontype(sword, 0, frac_zero, NULL, 0, 0, 0, SK_MELEE, 1); i_change(&u->items, sword, 1); set_level(u, SK_MELEE, 1); diff --git a/src/give.test.c b/src/give.test.c index 33f70fb90..1767dec36 100644 --- a/src/give.test.c +++ b/src/give.test.c @@ -324,8 +324,7 @@ static void test_give_herbs(CuTest * tc) { struct order *ord; test_setup_ex(tc); - test_create_world(); - env.f2 = env.f1 = test_create_faction(0); + env.f2 = env.f1 = test_create_faction(NULL); setup_give(&env); i_change(&env.src->items, env.itype, 10); diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index c01731964..80faba3c1 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -153,8 +153,7 @@ static void test_set_origin(CuTest *tc) { int x = 0, y = 0; plane *pl; - test_cleanup(); - test_create_world(); + test_setup(); pl = create_new_plane(0, "", 0, 19, 0, 19, 0); f = test_create_faction(0); CuAssertPtrEquals(tc, 0, f->ursprung); @@ -179,8 +178,7 @@ static void test_set_origin_bug(CuTest *tc) { plane *pl; int x = 17, y = 10; - test_cleanup(); - test_create_world(); + test_setup(); pl = create_new_plane(0, "", 0, 19, 0, 19, 0); f = test_create_faction(0); faction_setorigin(f, 0, -10, 3); diff --git a/src/reports.test.c b/src/reports.test.c index 976e9dfe1..f66d94684 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -45,18 +45,11 @@ static void test_reorder_units(CuTest * tc) ship * s; unit *u0, *u1, *u2, *u3, *u4; struct faction * f; - const building_type *btype; - const ship_type *stype; - test_cleanup(); - test_create_world(); - - btype = bt_find("castle"); - stype = st_find("boat"); - - r = findregion(-1, 0); - b = test_create_building(r, btype); - s = test_create_ship(r, stype); + test_setup(); + r = test_create_region(0, 0, NULL); + b = test_create_building(r, NULL); + s = test_create_ship(r, NULL); f = test_create_faction(0); u0 = test_create_unit(f, r); diff --git a/src/spells/magicresistance.test.c b/src/spells/magicresistance.test.c index e9cc98e34..621d2c3b4 100644 --- a/src/spells/magicresistance.test.c +++ b/src/spells/magicresistance.test.c @@ -28,13 +28,12 @@ static void test_magicresistance_unit(CuTest *tc) { message *msg; curse *c; - test_cleanup(); - test_create_world(); - r=findregion(0, 0); - f1 = test_create_faction(test_create_race("human")); + test_setup(); + r = test_create_plain(0, 0); + f1 = test_create_faction(NULL); u1 = test_create_unit(f1, r); - f2 = test_create_faction(test_create_race("human")); + f2 = test_create_faction(NULL); u2 = test_create_unit(f2, r); c = create_curse(u1, &u2->attribs, ct_find("magicresistance"), 10, 20, 30, u2->number); @@ -56,13 +55,12 @@ static void test_magicresistance_building(CuTest *tc) { message *msg; curse *c; - test_cleanup(); - test_create_world(); - r = findregion(0, 0); - f1 = test_create_faction(test_create_race("human")); + test_setup(); + r = test_create_plain(0, 0); + f1 = test_create_faction(NULL); u1 = test_create_unit(f1, r); - b1 = test_create_building(r, test_create_buildingtype("castle")); + b1 = test_create_building(r, NULL); c = create_curse(u1, &b1->attribs, ct_find("magicresistance"), 10, 20, 30, 0); CuAssertPtrNotNull(tc, b1->attribs);