Also test that I can rename a ship that I myself own, of course.

This commit is contained in:
Enno Rehling 2017-11-12 15:09:57 +01:00
parent db3feeedcc
commit ac8ca5f728
1 changed files with 11 additions and 7 deletions

View File

@ -990,15 +990,14 @@ static void test_name_ship(CuTest *tc) {
unit *uo, *u, *ux; unit *uo, *u, *ux;
faction *f; faction *f;
test_setup(); u = setup_name_cmd();
u->ship = test_create_ship(u->region, 0);
f = u->faction;
uo = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL)); uo = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
uo->ship = test_create_ship(uo->region, 0); u_set_ship(uo, u->ship);
f = test_create_faction(NULL);
ux = test_create_unit(f, test_create_region(0, 0, NULL)); ux = test_create_unit(f, test_create_region(0, 0, NULL));
u_set_ship(ux, uo->ship); u_set_ship(ux, u->ship);
u = test_create_unit(f, test_create_region(0, 0, NULL));
u_set_ship(u, uo->ship);
u->thisorder = create_order(K_NAME, f->locale, "%s Hodor", LOC(f->locale, parameters[P_SHIP])); u->thisorder = create_order(K_NAME, f->locale, "%s Hodor", LOC(f->locale, parameters[P_SHIP]));
ship_set_owner(uo); ship_set_owner(uo);
@ -1006,6 +1005,11 @@ static void test_name_ship(CuTest *tc) {
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error12")); CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error12"));
test_clear_messages(f); test_clear_messages(f);
ship_set_owner(u);
name_cmd(u, u->thisorder);
CuAssertStrEquals(tc, "Hodor", u->ship->name);
ship_setname(u->ship, "Titanic");
ship_set_owner(ux); ship_set_owner(ux);
name_cmd(u, u->thisorder); name_cmd(u, u->thisorder);
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error12")); CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error12"));