forked from github/server
set volcano acitvation chance to 0 during test.
should fix issue #606 for good. also: additional tests for renumbering ships, Xolgrim is wrong.
This commit is contained in:
parent
ecbd0ba83c
commit
14b4ae5859
|
@ -380,6 +380,21 @@ function test_events()
|
|||
assert(fail==0)
|
||||
end
|
||||
|
||||
function test_renumber_ship()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("noreply4@eressea.de", "human", "de")
|
||||
local u = unit.create(f, r)
|
||||
local s = ship.create(r, config.ships[1])
|
||||
u.ship = s
|
||||
u:add_order("NUMMER SCHIFF 1")
|
||||
process_orders()
|
||||
assert_equal(1, s.id)
|
||||
u:clear_orders()
|
||||
u:add_order("NUMMER SCHIFF 2")
|
||||
process_orders()
|
||||
assert_equal(2, s.id)
|
||||
end
|
||||
|
||||
function test_recruit2()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("noreply4@eressea.de", "human", "de")
|
||||
|
|
|
@ -7,7 +7,7 @@ function setup()
|
|||
eressea.settings.set("nmr.timeout", "0")
|
||||
eressea.settings.set("rules.grow.formula", "0")
|
||||
eressea.settings.set("rules.peasants.growth.factor", "0")
|
||||
eressea.settings.set("volcano.active.percent", "4")
|
||||
eressea.settings.set("volcano.active.percent", "0")
|
||||
end
|
||||
|
||||
function test_snowglobe_fail()
|
||||
|
|
|
@ -102,6 +102,27 @@ static void test_renumber_ship(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_renumber_ship_twice(CuTest *tc) {
|
||||
unit *u;
|
||||
int uno, no;
|
||||
const struct locale *lang;
|
||||
|
||||
test_setup_ex(tc);
|
||||
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
|
||||
u->ship = test_create_ship(u->region, 0);
|
||||
no = u->ship->no;
|
||||
uno = (no > 1) ? no - 1 : no + 1;
|
||||
lang = u->faction->locale;
|
||||
u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_SHIP]), itoa36(uno));
|
||||
renumber_cmd(u, u->thisorder);
|
||||
CuAssertIntEquals(tc, uno, u->ship->no);
|
||||
free_order(u->thisorder);
|
||||
u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_SHIP]), itoa36(no));
|
||||
renumber_cmd(u, u->thisorder);
|
||||
CuAssertIntEquals(tc, no, u->ship->no);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_renumber_ship_duplicate(CuTest *tc) {
|
||||
unit *u;
|
||||
faction *f;
|
||||
|
@ -204,6 +225,7 @@ CuSuite *get_renumber_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_renumber_building);
|
||||
SUITE_ADD_TEST(suite, test_renumber_building_duplicate);
|
||||
SUITE_ADD_TEST(suite, test_renumber_ship);
|
||||
SUITE_ADD_TEST(suite, test_renumber_ship_twice);
|
||||
SUITE_ADD_TEST(suite, test_renumber_ship_duplicate);
|
||||
SUITE_ADD_TEST(suite, test_renumber_faction);
|
||||
SUITE_ADD_TEST(suite, test_renumber_faction_duplicate);
|
||||
|
|
Loading…
Reference in New Issue