From acfe72f24e0a11b8f58801b96bd957ef7b4307f9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 20 Aug 2014 07:00:58 +0200 Subject: [PATCH] add a test for get_monsters(). I want to make sure I don't break this in the future. --- res/eressea/strings.xml | 2 +- src/kernel/CMakeLists.txt | 1 + src/kernel/faction.test.c | 27 +++++++++++++++++++++++++++ src/test_eressea.c | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/kernel/faction.test.c diff --git a/res/eressea/strings.xml b/res/eressea/strings.xml index e235c4338..387ca981e 100644 --- a/res/eressea/strings.xml +++ b/res/eressea/strings.xml @@ -223,7 +223,7 @@ This badge pronounces its wearer an official visitor to the - region of Muschelplateau. + embassies of Muschelplateau. Dieses Abzeichen identifiziert die Partei seines Trägers offiziell als einen Besucher der Botschafterregion 'Muschelplateau'. diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index ac524bfbc..898048c0c 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -3,6 +3,7 @@ project(kernel C) SET(_TEST_FILES build.test.c config.test.c +faction.test.c save.test.c ship.test.c spell.test.c diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c new file mode 100644 index 000000000..9ac975789 --- /dev/null +++ b/src/kernel/faction.test.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include "faction.h" +#include +#include + +void test_get_monsters(CuTest *tc) { + faction *f; + CuAssertPtrEquals(tc, NULL, get_monsters()); + f = get_or_create_monsters(); + CuAssertPtrEquals(tc, f, get_monsters()); + CuAssertIntEquals(tc, 666, f->no); + CuAssertStrEquals(tc, "Monster", f->name); + free_gamedata(); + CuAssertPtrEquals(tc, NULL, get_monsters()); + f = get_or_create_monsters(); + CuAssertPtrEquals(tc, f, get_monsters()); + CuAssertIntEquals(tc, 666, f->no); +} + +CuSuite *get_faction_suite(void) +{ + CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_get_monsters); + return suite; +} diff --git a/src/test_eressea.c b/src/test_eressea.c index 3f3061490..576be8b60 100644 --- a/src/test_eressea.c +++ b/src/test_eressea.c @@ -34,6 +34,7 @@ int RunAllTests(void) ADD_TESTS(suite, functions); ADD_TESTS(suite, umlaut); /* kernel */ + ADD_TESTS(suite, faction); ADD_TESTS(suite, build); ADD_TESTS(suite, pool); ADD_TESTS(suite, curse);