From db3feeedcce90bb877a30643ae532ebee230638b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 12 Nov 2017 15:05:17 +0100 Subject: [PATCH] combine ship naming tests. --- src/laws.test.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/src/laws.test.c b/src/laws.test.c index 5e23eded1..188bbef9a 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -987,29 +987,6 @@ static void test_name_building(CuTest *tc) { } static void test_name_ship(CuTest *tc) { - unit *u; - faction *f; - order *ord; - - u = setup_name_cmd(); - f = u->faction; - u->ship = test_create_ship(u->region, 0); - - ord = create_order(K_NAME, f->locale, "%s Hodor", LOC(f->locale, parameters[P_SHIP])); - name_cmd(u, ord); - CuAssertStrEquals(tc, "Hodor", u->ship->name); - free_order(ord); - - ord = create_order(K_NAME, f->locale, LOC(f->locale, parameters[P_SHIP])); - name_cmd(u, ord); - CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error84")); - CuAssertStrEquals(tc, "Hodor", u->ship->name); - free_order(ord); - - test_cleanup(); -} - -static void test_name_cmd_2384(CuTest *tc) { unit *uo, *u, *ux; faction *f; @@ -1034,6 +1011,13 @@ static void test_name_cmd_2384(CuTest *tc) { CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error12")); CuAssertStrEquals(tc, "Hodor", u->ship->name); + test_clear_messages(f); + free_order(u->thisorder); + u->thisorder = create_order(K_NAME, f->locale, LOC(f->locale, parameters[P_SHIP])); + name_cmd(u, u->thisorder); + CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error84")); + CuAssertStrEquals(tc, "Hodor", u->ship->name); + test_cleanup(); } @@ -1776,8 +1760,11 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_nmr_warnings); SUITE_ADD_TEST(suite, test_ally_cmd); SUITE_ADD_TEST(suite, test_name_cmd); - SUITE_ADD_TEST(suite, test_name_cmd_2384); SUITE_ADD_TEST(suite, test_name_cmd_2274); + SUITE_ADD_TEST(suite, test_name_unit); + SUITE_ADD_TEST(suite, test_name_region); + SUITE_ADD_TEST(suite, test_name_building); + SUITE_ADD_TEST(suite, test_name_ship); SUITE_ADD_TEST(suite, test_ally_cmd_errors); SUITE_ADD_TEST(suite, test_long_order_normal); SUITE_ADD_TEST(suite, test_long_order_none); @@ -1827,10 +1814,6 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_mail_region_no_msg); SUITE_ADD_TEST(suite, test_mail_faction_no_target); SUITE_ADD_TEST(suite, test_luck_message); - SUITE_ADD_TEST(suite, test_name_unit); - SUITE_ADD_TEST(suite, test_name_region); - SUITE_ADD_TEST(suite, test_name_building); - SUITE_ADD_TEST(suite, test_name_ship); SUITE_ADD_TEST(suite, test_show_without_item); SUITE_ADD_TEST(suite, test_show_race); SUITE_ADD_TEST(suite, test_show_both);