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) {
|
||||
unit *pirate, *victim;
|
||||
unit *u;
|
||||
order *ord;
|
||||
region *r;
|
||||
faction *f;
|
||||
int target;
|
||||
const terrain_type *t_plain;
|
||||
const ship_type *stype;
|
||||
|
||||
test_cleanup();
|
||||
|
||||
setup_pirate(&pirate, 0, 0, "boat", &ord, &victim, SEA_REGION, "boat");
|
||||
set_level(pirate, SK_SAILING, pirate->ship->type->sumskill);
|
||||
r = pirate->region;
|
||||
setup_piracy();
|
||||
t_plain = get_or_create_terrain("plain");
|
||||
stype = test_create_shiptype("boat");
|
||||
|
||||
piracy_cmd(pirate, ord);
|
||||
CuAssertPtrEquals(tc, 0, pirate->thisorder);
|
||||
CuAssertTrue(tc, pirate->region == r);
|
||||
/* TODO check message
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY movement", test_find_messagetype(pirate->faction->msgs, "travel"));
|
||||
*/
|
||||
// create a target:
|
||||
r = test_create_region(0, 0, t_plain);
|
||||
f = test_create_faction(0);
|
||||
u = test_create_unit(f, r);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
return suite;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue