diff --git a/src/kernel/building.test.c b/src/kernel/building.test.c index cd29601eb..edbcce98b 100644 --- a/src/kernel/building.test.c +++ b/src/kernel/building.test.c @@ -22,6 +22,7 @@ static void test_register_building(CuTest * tc) bt_register(btype); CuAssertPtrNotNull(tc, bt_find("herp")); + test_cleanup(); } static void test_building_set_owner(CuTest * tc) @@ -51,6 +52,7 @@ static void test_building_set_owner(CuTest * tc) CuAssertPtrEquals(tc, u1, building_owner(bld)); building_set_owner(u2); CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_next_when_empty(CuTest * tc) @@ -85,6 +87,7 @@ static void test_buildingowner_goes_to_next_when_empty(CuTest * tc) CuAssertPtrEquals(tc, u, building_owner(bld)); u->number = 0; CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_other_when_empty(CuTest * tc) @@ -120,6 +123,7 @@ static void test_buildingowner_goes_to_other_when_empty(CuTest * tc) CuAssertPtrEquals(tc, u, building_owner(bld)); u->number = 0; CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_same_faction_when_empty(CuTest * tc) @@ -159,6 +163,7 @@ static void test_buildingowner_goes_to_same_faction_when_empty(CuTest * tc) CuAssertPtrEquals(tc, u3, building_owner(bld)); u3->number = 0; CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_next_after_leave(CuTest * tc) @@ -193,6 +198,7 @@ static void test_buildingowner_goes_to_next_after_leave(CuTest * tc) CuAssertPtrEquals(tc, u, building_owner(bld)); leave_building(u); CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_other_after_leave(CuTest * tc) @@ -227,6 +233,7 @@ static void test_buildingowner_goes_to_other_after_leave(CuTest * tc) CuAssertPtrEquals(tc, u, building_owner(bld)); leave_building(u); CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_goes_to_same_faction_after_leave(CuTest * tc) @@ -268,6 +275,7 @@ static void test_buildingowner_goes_to_same_faction_after_leave(CuTest * tc) CuAssertPtrEquals(tc, u2, building_owner(bld)); leave_building(u2); CuAssertPtrEquals(tc, 0, building_owner(bld)); + test_cleanup(); } static void test_buildingowner_resets_when_empty(CuTest * tc) @@ -302,6 +310,7 @@ static void test_buildingowner_resets_when_empty(CuTest * tc) CuAssertPtrEquals(tc, 0, building_owner(bld)); u->number = 1; CuAssertPtrEquals(tc, u, building_owner(bld)); + test_cleanup(); } void test_buildingowner_goes_to_empty_unit_after_leave(CuTest * tc) @@ -343,6 +352,7 @@ void test_buildingowner_goes_to_empty_unit_after_leave(CuTest * tc) CuAssertPtrEquals(tc, 0, building_owner(bld)); u2->number = 1; CuAssertPtrEquals(tc, u2, building_owner(bld)); + test_cleanup(); } CuSuite *get_building_suite(void) diff --git a/src/kernel/terrain.c b/src/kernel/terrain.c index 4728d7b2b..076e64da6 100644 --- a/src/kernel/terrain.c +++ b/src/kernel/terrain.c @@ -63,8 +63,7 @@ const char *terraindata[MAXTERRAINS] = { static terrain_type *registered_terrains; -#ifndef DISABLE_TESTS -void test_clear_terrains(void) +void free_terrains(void) { while (registered_terrains) { terrain_type * t = registered_terrains; @@ -74,7 +73,6 @@ void test_clear_terrains(void) free(t); } } -#endif const terrain_type *terrains(void) { diff --git a/src/kernel/terrain.h b/src/kernel/terrain.h index 15e0318a9..3630a2e7b 100644 --- a/src/kernel/terrain.h +++ b/src/kernel/terrain.h @@ -75,10 +75,7 @@ extern "C" { extern const char *terrain_name(const struct region *r); extern void init_terrains(void); - -#ifndef DISABLE_TESTS - void test_clear_terrains(void); -#endif + void free_terrains(void); #ifdef __cplusplus } diff --git a/src/tests.c b/src/tests.c index 7f7b73d75..1de72b768 100644 --- a/src/tests.c +++ b/src/tests.c @@ -57,7 +57,7 @@ struct unit *test_create_unit(struct faction *f, struct region *r) void test_cleanup(void) { - test_clear_terrains(); + free_terrains(); test_clear_resources(); global.functions.maintenance = NULL; global.functions.wage = NULL;