forked from github/server
add a unit test for make_movement_order, too.
This commit is contained in:
parent
0171c74e19
commit
2f7637f953
1 changed files with 21 additions and 0 deletions
|
@ -654,6 +654,26 @@ static void test_movement_speed_dragon(CuTest *tc) {
|
|||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_make_movement_order(CuTest *tc) {
|
||||
order *ord;
|
||||
char buffer[32];
|
||||
struct locale *lang;
|
||||
direction_t steps[] = { D_EAST, D_WEST, D_EAST, D_WEST };
|
||||
|
||||
test_setup();
|
||||
lang = test_create_locale();
|
||||
|
||||
ord = make_movement_order(lang, steps, 2);
|
||||
CuAssertStrEquals(tc, "move east west", get_command(ord, lang, buffer, sizeof(buffer)));
|
||||
free_order(ord);
|
||||
|
||||
ord = make_movement_order(lang, steps, 4);
|
||||
CuAssertStrEquals(tc, "move east west east west", get_command(ord, lang, buffer, sizeof(buffer)));
|
||||
free_order(ord);
|
||||
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
CuSuite *get_move_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -684,5 +704,6 @@ CuSuite *get_move_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_route_cycle);
|
||||
SUITE_ADD_TEST(suite, test_cycle_route);
|
||||
SUITE_ADD_TEST(suite, test_route_pause);
|
||||
SUITE_ADD_TEST(suite, test_make_movement_order);
|
||||
return suite;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue