add a test for get_monsters().

I want to make sure I don't break this in the future.
This commit is contained in:
Enno Rehling 2014-08-20 07:00:58 +02:00
parent 5c7b93d0ce
commit fb7c8a898f
4 changed files with 30 additions and 1 deletions

View File

@ -223,7 +223,7 @@
</string>
<string name="seashell">
<text locale="en">This badge pronounces its wearer an official visitor to the
region of Muschelplateau.</text>
embassies of Muschelplateau.</text>
<text locale="de">Dieses Abzeichen identifiziert die Partei seines Trägers offiziell
als einen Besucher der Botschafterregion 'Muschelplateau'.</text>
</string>

View File

@ -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

27
src/kernel/faction.test.c Normal file
View File

@ -0,0 +1,27 @@
#include <platform.h>
#include <kernel/types.h>
#include <kernel/config.h>
#include "faction.h"
#include <CuTest.h>
#include <stdio.h>
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;
}

View File

@ -63,6 +63,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);