From f8167ed62caab84b93c523982800f429e85b339b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 19 Sep 2016 06:47:46 +0200 Subject: [PATCH] test get_race and others --- src/kernel/race.test.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/kernel/race.test.c b/src/kernel/race.test.c index e8bbfcf29..25bd3e912 100644 --- a/src/kernel/race.test.c +++ b/src/kernel/race.test.c @@ -9,7 +9,7 @@ static void test_rc_name(CuTest *tc) { struct race *rc; - test_cleanup(); + test_setup(); rc = test_create_race("human"); CuAssertStrEquals(tc, "race::human", rc_name_s(rc, NAME_SINGULAR)); CuAssertStrEquals(tc, "race::human_p", rc_name_s(rc, NAME_PLURAL)); @@ -20,7 +20,7 @@ static void test_rc_name(CuTest *tc) { static void test_rc_defaults(CuTest *tc) { struct race *rc; - test_cleanup(); + test_setup(); rc = rc_get_or_create("human"); CuAssertStrEquals(tc, "human", rc->_name); CuAssertDblEquals(tc, 0.0, rc->magres, 0.0); @@ -43,15 +43,25 @@ static void test_rc_defaults(CuTest *tc) { static void test_rc_find(CuTest *tc) { race *rc; - test_cleanup(); + test_setup(); rc = test_create_race("hungryhippos"); CuAssertPtrEquals(tc, rc, (void *)rc_find("hungryhippos")); test_cleanup(); } +static void test_race_get(CuTest *tc) { + race *rc; + test_setup(); + rc = get_race(RC_ELF); + CuAssertPtrEquals(tc, rc, (void *)rc_find("elf")); + CuAssertPtrEquals(tc, rc, (void *)rc_get_or_create("elf")); + test_cleanup(); +} + CuSuite *get_race_suite(void) { CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_race_get); SUITE_ADD_TEST(suite, test_rc_name); SUITE_ADD_TEST(suite, test_rc_defaults); SUITE_ADD_TEST(suite, test_rc_find);