add skeleton test suite for piracy

This commit is contained in:
Enno Rehling 2015-10-12 11:54:59 +02:00
parent 521519805d
commit 678169d7d4
3 changed files with 36 additions and 0 deletions

View file

@ -201,6 +201,7 @@ set(TESTS_SRC
magic.test.c magic.test.c
market.test.c market.test.c
move.test.c move.test.c
piracy.test.c
prefix.test.c prefix.test.c
skill.test.c skill.test.c
spells.test.c spells.test.c

34
src/piracy.test.c Normal file
View file

@ -0,0 +1,34 @@
#include <platform.h>
#include "piracy.h"
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <kernel/order.h>
#include <util/language.h>
#include <CuTest.h>
#include <tests.h>
#include <assert.h>
static void test_piracy_cmd(CuTest * tc) {
unit *u;
order *ord;
test_cleanup();
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
u->faction->locale = get_or_create_locale("de");
ord = create_order(K_PIRACY, u->faction->locale, "");
assert(u);
piracy_cmd(u, ord);
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error144"));
test_cleanup();
}
CuSuite *get_piracy_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_piracy_cmd);
return suite;
}

View file

@ -89,6 +89,7 @@ int RunAllTests(void)
RUN_TESTS(suite, laws); RUN_TESTS(suite, laws);
RUN_TESTS(suite, market); RUN_TESTS(suite, market);
RUN_TESTS(suite, move); RUN_TESTS(suite, move);
RUN_TESTS(suite, piracy);
RUN_TESTS(suite, stealth); RUN_TESTS(suite, stealth);
RUN_TESTS(suite, upkeep); RUN_TESTS(suite, upkeep);
RUN_TESTS(suite, vortex); RUN_TESTS(suite, vortex);