From e04a541167f0ab602d9fda21c97f7157afbf7fe0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 31 Dec 2014 00:16:24 +0100 Subject: [PATCH] do not initialize resources in test_cleanup, that makes no sense. --- src/kernel/config.c | 2 -- src/tests.test.c | 18 ++++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index c7fa16fff..4e42f4e0c 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1759,8 +1759,6 @@ void free_gamedata(void) a_remove(&global.attribs, global.attribs); } ++global.cookie; /* readgame() already does this, but sjust in case */ - - init_resources(); } const char * game_name(void) { diff --git a/src/tests.test.c b/src/tests.test.c index fc2097516..06b59b175 100644 --- a/src/tests.test.c +++ b/src/tests.test.c @@ -13,6 +13,7 @@ static void test_resources(CuTest *tc) { resource_type *rtype; test_cleanup(); + init_resources(); CuAssertPtrNotNull(tc, rt_find("hp")); CuAssertPtrEquals(tc, rt_find("hp"), (void *)get_resourcetype(R_LIFE)); CuAssertPtrNotNull(tc, rt_find("peasant")); @@ -28,6 +29,7 @@ static void test_resources(CuTest *tc) { CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); test_cleanup(); CuAssertPtrEquals(tc, 0, rt_find("stone")); + CuAssertPtrEquals(tc, 0, rt_find("peasant")); rtype = rt_get_or_create("stone"); CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE)); } @@ -37,10 +39,6 @@ static void test_recreate_world(CuTest * tc) test_cleanup(); CuAssertPtrEquals(tc, 0, get_locale("de")); 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(); 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*)rt_find("horse")); CuAssertPtrEquals(tc, 0, (void*)get_resourcetype(R_HORSE)); - CuAssertPtrNotNull(tc, (void *)rt_find("money")); - CuAssertPtrNotNull(tc, get_resourcetype(R_LIFE)); - CuAssertPtrNotNull(tc, get_resourcetype(R_SILVER)); - CuAssertPtrNotNull(tc, get_resourcetype(R_AURA)); - CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA)); - CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT)); + CuAssertPtrEquals(tc, 0, (void *)rt_find("money")); + CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_LIFE)); + CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_SILVER)); + CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_AURA)); + CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PERMAURA)); + CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_PEASANT)); CuAssertPtrEquals(tc, 0, findregion(0, 0)); }