add a failing test for familiars (disabled).

remove superfluous init_locales calls.
This commit is contained in:
Enno Rehling 2017-02-11 22:28:57 +01:00
parent 10e78b1455
commit f6fcd39293
4 changed files with 20 additions and 3 deletions

View file

@ -20,7 +20,6 @@
#include "kernel/terrain.h" #include "kernel/terrain.h"
void config_reset(void) { void config_reset(void) {
default_locale = 0;
free_config(); free_config();
free_nrmesssages(); free_nrmesssages();
free_spells(); free_spells();

View file

@ -1470,7 +1470,6 @@ int readgame(const char *filename)
FILE *F; FILE *F;
size_t sz; size_t sz;
init_locales();
log_debug("- reading game data from %s", filename); log_debug("- reading game data from %s", filename);
join_path(datapath(), filename, path, sizeof(path)); join_path(datapath(), filename, path, sizeof(path));

View file

@ -4196,7 +4196,6 @@ void init_processor(void)
void processorders(void) void processorders(void)
{ {
init_locales();
init_processor(); init_processor();
process(); process();
/*************************************************/ /*************************************************/

View file

@ -2,6 +2,7 @@
#include "magic.h" #include "magic.h"
#include "teleport.h" #include "teleport.h"
#include "give.h"
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/race.h> #include <kernel/race.h>
@ -448,6 +449,24 @@ static void test_max_spellpoints(CuTest *tc) {
test_cleanup(); 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 *get_magic_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
@ -465,5 +484,6 @@ CuSuite *get_magic_suite(void)
SUITE_ADD_TEST(suite, test_hasspell); SUITE_ADD_TEST(suite, test_hasspell);
SUITE_ADD_TEST(suite, test_magic_resistance); SUITE_ADD_TEST(suite, test_magic_resistance);
SUITE_ADD_TEST(suite, test_max_spellpoints); SUITE_ADD_TEST(suite, test_max_spellpoints);
DISABLE_TEST(suite, test_familiar_mage);
return suite; return suite;
} }