From f6fcd392934fbaa90d2edb72421114da09d6f564 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 11 Feb 2017 22:28:57 +0100 Subject: [PATCH] add a failing test for familiars (disabled). remove superfluous init_locales calls. --- src/bind_config.c | 1 - src/kernel/save.c | 1 - src/laws.c | 1 - src/magic.test.c | 20 ++++++++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/bind_config.c b/src/bind_config.c index c603800ed..b4aa68d58 100644 --- a/src/bind_config.c +++ b/src/bind_config.c @@ -20,7 +20,6 @@ #include "kernel/terrain.h" void config_reset(void) { - default_locale = 0; free_config(); free_nrmesssages(); free_spells(); diff --git a/src/kernel/save.c b/src/kernel/save.c index 8ec797e68..67ed7e125 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1470,7 +1470,6 @@ int readgame(const char *filename) FILE *F; size_t sz; - init_locales(); log_debug("- reading game data from %s", filename); join_path(datapath(), filename, path, sizeof(path)); diff --git a/src/laws.c b/src/laws.c index 78ca6fba9..98ff5d9f6 100644 --- a/src/laws.c +++ b/src/laws.c @@ -4196,7 +4196,6 @@ void init_processor(void) void processorders(void) { - init_locales(); init_processor(); process(); /*************************************************/ diff --git a/src/magic.test.c b/src/magic.test.c index 4a6078589..07a6d5257 100644 --- a/src/magic.test.c +++ b/src/magic.test.c @@ -2,6 +2,7 @@ #include "magic.h" #include "teleport.h" +#include "give.h" #include #include @@ -448,6 +449,24 @@ static void test_max_spellpoints(CuTest *tc) { test_cleanup(); } +static void test_familiar_mage(CuTest *tc) { + unit *um, *uf, *ut; + test_setup(); + um = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0)); + uf = test_create_unit(um->faction, um->region); + ut = test_create_unit(um->faction, um->region); + set_number(ut, 0); + CuAssertTrue(tc, create_newfamiliar(um, uf)); + CuAssertTrue(tc, is_familiar(uf)); + CuAssertTrue(tc, !is_familiar(um)); + CuAssertPtrEquals(tc, um, get_familiar_mage(uf)); + CuAssertPtrEquals(tc, uf, get_familiar(um)); + + CuAssertPtrEquals(tc, NULL, give_men(1, um, ut, NULL)); + CuAssertPtrEquals(tc, ut, get_familiar_mage(uf)); + test_cleanup(); +} + CuSuite *get_magic_suite(void) { CuSuite *suite = CuSuiteNew(); @@ -465,5 +484,6 @@ CuSuite *get_magic_suite(void) SUITE_ADD_TEST(suite, test_hasspell); SUITE_ADD_TEST(suite, test_magic_resistance); SUITE_ADD_TEST(suite, test_max_spellpoints); + DISABLE_TEST(suite, test_familiar_mage); return suite; }