do not initialize resources in test_cleanup, that makes no sense.

This commit is contained in:
Enno Rehling 2014-12-31 00:16:24 +01:00
parent 0566dca971
commit e04a541167
2 changed files with 8 additions and 12 deletions

View File

@ -1759,8 +1759,6 @@ void free_gamedata(void)
a_remove(&global.attribs, global.attribs); a_remove(&global.attribs, global.attribs);
} }
++global.cookie; /* readgame() already does this, but sjust in case */ ++global.cookie; /* readgame() already does this, but sjust in case */
init_resources();
} }
const char * game_name(void) { const char * game_name(void) {

View File

@ -13,6 +13,7 @@
static void test_resources(CuTest *tc) { static void test_resources(CuTest *tc) {
resource_type *rtype; resource_type *rtype;
test_cleanup(); test_cleanup();
init_resources();
CuAssertPtrNotNull(tc, rt_find("hp")); CuAssertPtrNotNull(tc, rt_find("hp"));
CuAssertPtrEquals(tc, rt_find("hp"), (void *)get_resourcetype(R_LIFE)); CuAssertPtrEquals(tc, rt_find("hp"), (void *)get_resourcetype(R_LIFE));
CuAssertPtrNotNull(tc, rt_find("peasant")); CuAssertPtrNotNull(tc, rt_find("peasant"));
@ -28,6 +29,7 @@ static void test_resources(CuTest *tc) {
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
test_cleanup(); test_cleanup();
CuAssertPtrEquals(tc, 0, rt_find("stone")); CuAssertPtrEquals(tc, 0, rt_find("stone"));
CuAssertPtrEquals(tc, 0, rt_find("peasant"));
rtype = rt_get_or_create("stone"); rtype = rt_get_or_create("stone");
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
} }
@ -37,10 +39,6 @@ static void test_recreate_world(CuTest * tc)
test_cleanup(); test_cleanup();
CuAssertPtrEquals(tc, 0, get_locale("de")); CuAssertPtrEquals(tc, 0, get_locale("de"));
CuAssertPtrEquals(tc, 0, (void *)rt_find("horse")); CuAssertPtrEquals(tc, 0, (void *)rt_find("horse"));
CuAssertPtrNotNull(tc, get_resourcetype(R_LIFE));
CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, (void *)rt_find("money"));
test_create_world(); test_create_world();
CuAssertPtrEquals(tc, default_locale, get_locale("de")); CuAssertPtrEquals(tc, default_locale, get_locale("de"));
@ -63,12 +61,12 @@ static void test_recreate_world(CuTest * tc)
CuAssertPtrEquals(tc, 0, (void*)get_terrain("ocean")); CuAssertPtrEquals(tc, 0, (void*)get_terrain("ocean"));
CuAssertPtrEquals(tc, 0, (void*)rt_find("horse")); CuAssertPtrEquals(tc, 0, (void*)rt_find("horse"));
CuAssertPtrEquals(tc, 0, (void*)get_resourcetype(R_HORSE)); CuAssertPtrEquals(tc, 0, (void*)get_resourcetype(R_HORSE));
CuAssertPtrNotNull(tc, (void *)rt_find("money")); CuAssertPtrEquals(tc, 0, (void *)rt_find("money"));
CuAssertPtrNotNull(tc, get_resourcetype(R_LIFE)); CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_LIFE));
CuAssertPtrNotNull(tc, get_resourcetype(R_SILVER)); CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_SILVER));
CuAssertPtrNotNull(tc, get_resourcetype(R_AURA)); CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA)); CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PERMAURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT)); CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PEASANT));
CuAssertPtrEquals(tc, 0, findregion(0, 0)); CuAssertPtrEquals(tc, 0, findregion(0, 0));
} }