From 5fed36903cdd21e6e5fc4273c4341929d632ee8d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 25 Feb 2016 10:16:50 +0100 Subject: [PATCH] some drmemory fixes some tests leaked. current test_eressea reports: 41 unique, 41 total, 3778 byte(s) of leak(s) 120 unique, 270 total, 5615 byte(s) of possible leak(s) --- src/kernel/group.test.c | 2 +- src/move.test.c | 4 +--- src/tests.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/kernel/group.test.c b/src/kernel/group.test.c index cc8a8e4ce..c30e16f98 100644 --- a/src/kernel/group.test.c +++ b/src/kernel/group.test.c @@ -30,8 +30,8 @@ static void test_group_readwrite(CuTest * tc) gamedata *data; test_cleanup(); - test_create_world(); data = gamedata_open("test.dat", "wb", RELEASE_VERSION); + CuAssertPtrNotNull(tc, data); f = test_create_faction(0); g = new_group(f, "NW", 42); g = new_group(f, "Egoisten", 43); diff --git a/src/move.test.c b/src/move.test.c index c4e9944c9..81398ec62 100644 --- a/src/move.test.c +++ b/src/move.test.c @@ -35,8 +35,6 @@ static void test_ship_not_allowed_in_coast(CuTest * tc) ship_type *stype; test_cleanup(); - test_create_world(); - ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO); otype = test_create_terrain("ocean", SEA_REGION | SAIL_INTO); stype = test_create_shiptype("derp"); @@ -50,6 +48,7 @@ static void test_ship_not_allowed_in_coast(CuTest * tc) CuAssertIntEquals(tc, SA_NO_COAST, check_ship_allowed(sh, r1)); stype->coasts[0] = ttype; CuAssertIntEquals(tc, SA_COAST, check_ship_allowed(sh, r1)); + test_cleanup(); } typedef struct move_fixture { @@ -68,7 +67,6 @@ static void setup_harbor(move_fixture *mf) { unit *u; test_cleanup(); - test_create_world(); ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO); btype = test_create_buildingtype("harbour"); diff --git a/src/tests.c b/src/tests.c index b52759489..69d4d4f2b 100644 --- a/src/tests.c +++ b/src/tests.c @@ -156,7 +156,7 @@ ship_type * test_create_shiptype(const char * name) stype->coasts = (terrain_type **)malloc(sizeof(terrain_type *)*2); - stype->coasts[0] = get_or_create_terrain("plain"); + stype->coasts[0] = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO); stype->coasts[1] = NULL; if (default_locale) {