use test_setup to start tests

This commit is contained in:
Enno Rehling 2016-09-08 08:12:26 +02:00
parent cb706c2cf2
commit 25e5d1d285
3 changed files with 17 additions and 17 deletions

View File

@ -27,7 +27,7 @@ void test_updatespells(CuTest * tc)
spell * sp; spell * sp;
spellbook *book = 0; spellbook *book = 0;
test_cleanup(); test_setup();
test_create_race("human"); test_create_race("human");
f = test_create_faction(0); f = test_create_faction(0);
@ -53,7 +53,7 @@ void test_spellbooks(CuTest * tc)
spellbook *herp, *derp; spellbook *herp, *derp;
spellbook_entry *entry; spellbook_entry *entry;
const char * sname = "herpderp"; const char * sname = "herpderp";
test_cleanup(); test_setup();
herp = get_spellbook("herp"); herp = get_spellbook("herp");
CuAssertPtrNotNull(tc, herp); CuAssertPtrNotNull(tc, herp);
@ -85,7 +85,7 @@ void test_pay_spell(CuTest * tc)
region * r; region * r;
int level; int level;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -119,7 +119,7 @@ void test_pay_spell_failure(CuTest * tc)
struct region * r; struct region * r;
int level; int level;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -157,7 +157,7 @@ void test_getspell_unit(CuTest * tc)
struct region * r; struct region * r;
struct locale * lang; struct locale * lang;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -186,7 +186,7 @@ void test_getspell_faction(CuTest * tc)
struct region * r; struct region * r;
struct locale * lang; struct locale * lang;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -218,7 +218,7 @@ void test_getspell_school(CuTest * tc)
struct locale * lang; struct locale * lang;
struct spellbook * book; struct spellbook * book;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -249,7 +249,7 @@ void test_set_pre_combatspell(CuTest * tc)
struct region * r; struct region * r;
const int index = 0; const int index = 0;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -282,7 +282,7 @@ void test_set_main_combatspell(CuTest * tc)
struct region * r; struct region * r;
const int index = 1; const int index = 1;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -315,7 +315,7 @@ void test_set_post_combatspell(CuTest * tc)
struct region * r; struct region * r;
const int index = 2; const int index = 2;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -347,7 +347,7 @@ void test_hasspell(CuTest * tc)
struct faction * f; struct faction * f;
struct region * r; struct region * r;
test_cleanup(); test_setup();
test_create_world(); test_create_world();
r = findregion(0, 0); r = findregion(0, 0);
f = test_create_faction(0); f = test_create_faction(0);
@ -382,7 +382,7 @@ void test_multi_cast(CuTest *tc) {
spell *sp; spell *sp;
struct locale * lang; struct locale * lang;
test_cleanup(); test_setup();
sp = create_spell("fireball", 0); sp = create_spell("fireball", 0);
sp->cast = cast_fireball; sp->cast = cast_fireball;
CuAssertPtrEquals(tc, sp, find_spell("fireball")); CuAssertPtrEquals(tc, sp, find_spell("fireball"));
@ -410,7 +410,7 @@ static void test_magic_resistance(CuTest *tc) {
unit *u; unit *u;
race *rc; race *rc;
test_cleanup(); test_setup();
rc = test_create_race("human"); rc = test_create_race("human");
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0)); u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
CuAssertDblEquals(tc, rc->magres, magic_resistance(u), 0.01); CuAssertDblEquals(tc, rc->magres, magic_resistance(u), 0.01);

View File

@ -12,7 +12,7 @@
static void test_resources(CuTest *tc) { static void test_resources(CuTest *tc) {
resource_type *rtype; resource_type *rtype;
test_cleanup(); test_setup();
init_resources(); 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));
@ -36,7 +36,7 @@ static void test_resources(CuTest *tc) {
static void test_recreate_world(CuTest * tc) static void test_recreate_world(CuTest * tc)
{ {
test_cleanup(); test_setup();
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"));

View File

@ -19,7 +19,7 @@ static void test_volcano_update(CuTest *tc) {
message *m; message *m;
const struct terrain_type *t_volcano, *t_active; const struct terrain_type *t_volcano, *t_active;
test_cleanup(); test_setup();
mt_register(mt_new_va("volcanostopsmoke", "region:region", 0)); mt_register(mt_new_va("volcanostopsmoke", "region:region", 0));
t_volcano = test_create_terrain("volcano", LAND_REGION); t_volcano = test_create_terrain("volcano", LAND_REGION);
t_active = test_create_terrain("activevolcano", LAND_REGION); t_active = test_create_terrain("activevolcano", LAND_REGION);
@ -41,7 +41,7 @@ static void test_volcano_outbreak(CuTest *tc) {
message *m; message *m;
const struct terrain_type *t_volcano, *t_active; const struct terrain_type *t_volcano, *t_active;
test_cleanup(); test_setup();
mt_register(mt_new_va("volcanooutbreak", "regionv:region", "regionn:region", 0)); mt_register(mt_new_va("volcanooutbreak", "regionv:region", "regionn:region", 0));
mt_register(mt_new_va("volcano_dead", "unit:unit", "region:region", "dead:int", 0)); mt_register(mt_new_va("volcano_dead", "unit:unit", "region:region", "dead:int", 0));
t_volcano = test_create_terrain("volcano", LAND_REGION); t_volcano = test_create_terrain("volcano", LAND_REGION);