forked from github/server
fix piracy_cmd_land_to_land
This commit is contained in:
parent
c755de1cd5
commit
860078cfc9
|
@ -178,22 +178,39 @@ static void test_piracy_cmd_walking(CuTest * tc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_piracy_cmd_land_to_land(CuTest * tc) {
|
static void test_piracy_cmd_land_to_land(CuTest * tc) {
|
||||||
unit *pirate, *victim;
|
unit *u;
|
||||||
order *ord;
|
order *ord;
|
||||||
region *r;
|
region *r;
|
||||||
|
faction *f;
|
||||||
|
int target;
|
||||||
|
const terrain_type *t_plain;
|
||||||
|
const ship_type *stype;
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
||||||
setup_pirate(&pirate, 0, 0, "boat", &ord, &victim, SEA_REGION, "boat");
|
setup_piracy();
|
||||||
set_level(pirate, SK_SAILING, pirate->ship->type->sumskill);
|
t_plain = get_or_create_terrain("plain");
|
||||||
r = pirate->region;
|
stype = test_create_shiptype("boat");
|
||||||
|
|
||||||
piracy_cmd(pirate, ord);
|
// create a target:
|
||||||
CuAssertPtrEquals(tc, 0, pirate->thisorder);
|
r = test_create_region(0, 0, t_plain);
|
||||||
CuAssertTrue(tc, pirate->region == r);
|
f = test_create_faction(0);
|
||||||
/* TODO check message
|
u = test_create_unit(f, r);
|
||||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY movement", test_find_messagetype(pirate->faction->msgs, "travel"));
|
u->ship = test_create_ship(r, stype);
|
||||||
*/
|
target = f->no;
|
||||||
|
|
||||||
|
// create a pirate:
|
||||||
|
r = test_create_region(1, 0, t_plain);
|
||||||
|
f = test_create_faction(0);
|
||||||
|
u = test_create_unit(f, r);
|
||||||
|
u->ship = test_create_ship(r, stype);
|
||||||
|
set_level(u, SK_SAILING, u->ship->type->sumskill);
|
||||||
|
ord = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
|
||||||
|
|
||||||
|
piracy_cmd(u, ord);
|
||||||
|
CuAssertPtrEquals(tc, 0, u->thisorder);
|
||||||
|
CuAssertPtrEquals(tc, r, u->region);
|
||||||
|
// TODO check message
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
@ -226,7 +243,7 @@ CuSuite *get_piracy_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_piracy_cmd_errors);
|
SUITE_ADD_TEST(suite, test_piracy_cmd_errors);
|
||||||
SUITE_ADD_TEST(suite, test_piracy_cmd);
|
SUITE_ADD_TEST(suite, test_piracy_cmd);
|
||||||
SUITE_ADD_TEST(suite, test_piracy_cmd_walking);
|
SUITE_ADD_TEST(suite, test_piracy_cmd_walking);
|
||||||
DISABLE_TEST(suite, test_piracy_cmd_land_to_land);
|
SUITE_ADD_TEST(suite, test_piracy_cmd_land_to_land);
|
||||||
SUITE_ADD_TEST(suite, test_piracy_cmd_swimmer);
|
SUITE_ADD_TEST(suite, test_piracy_cmd_swimmer);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue