forked from github/server
always create test units inside a region (so they can get destroyed in free_gamedata)
This commit is contained in:
parent
22586aa45f
commit
a281ace21b
4 changed files with 4 additions and 4 deletions
|
@ -74,7 +74,7 @@ void test_change_item(CuTest * tc)
|
|||
test_create_itemtype("iron");
|
||||
init_resources();
|
||||
|
||||
u = test_create_unit(test_create_faction(0), 0);
|
||||
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
|
||||
test_uchange(tc, u, get_resourcetype(R_IRON));
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ static void test_write_travelthru(CuTest *tc) {
|
|||
r->flags |= RF_TRAVELUNIT;
|
||||
f = test_create_faction(0);
|
||||
f->locale = lang;
|
||||
u = test_create_unit(f, 0);
|
||||
u = test_create_unit(f, test_create_region(0, 1, 0));
|
||||
unit_setname(u, "Hodor");
|
||||
unit_setid(u, 1);
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ static void test_demon_skillchanges(CuTest *tc) {
|
|||
test_setup();
|
||||
rc = test_create_race("demon");
|
||||
CuAssertPtrEquals(tc, rc, get_race(RC_DAEMON));
|
||||
u = test_create_unit(test_create_faction(rc), 0);
|
||||
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
|
||||
CuAssertPtrNotNull(tc, u);
|
||||
set_level(u, SK_CROSSBOW, 1);
|
||||
demon_skillchange(u);
|
||||
|
|
|
@ -119,7 +119,7 @@ struct faction *test_create_faction(const struct race *rc)
|
|||
struct unit *test_create_unit(struct faction *f, struct region *r)
|
||||
{
|
||||
const struct race * rc = f ? f->race : 0;
|
||||
assert(f || !r);
|
||||
assert(f && r);
|
||||
if (!rc) rc = rc_get_or_create("human");
|
||||
return create_unit(r, f, 1, rc ? rc : rc_get_or_create("human"), 0, 0, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue