-
-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a unit test for [move_unit]location_id with an occupied hex
- Loading branch information
1 parent
904bb9b
commit ba1767f
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# wmllint: no translatables | ||
|
||
##### | ||
# API(s) being tested: [move_unit]to_location | ||
## | ||
# Actions: | ||
# Try to move Alice to the hex that Bob already occupies. | ||
## | ||
# Expected end state: | ||
# Bob has not moved and both units are still on the map. | ||
# Alice is adjacent to Bob. | ||
# | ||
# The main "test_move_unit" includes a check that moving to an occupied | ||
# location by x,y coordinates doesn't overwrite the existing unit. This | ||
# tests the same, using a location_id. | ||
##### | ||
{GENERIC_UNIT_TEST "test_move_unit_to_occupied_location" ( | ||
[event] | ||
name=start | ||
{ASSERT ( | ||
[have_unit] | ||
id=alice | ||
x=7 | ||
y=3 | ||
[/have_unit] | ||
[have_unit] | ||
id=bob | ||
x=13 | ||
y=3 | ||
[/have_unit] | ||
)} | ||
|
||
[move_unit] | ||
id=alice | ||
to_location=2 | ||
[/move_unit] | ||
|
||
# She ends up one hex north-west of Bob instead, for consistency this | ||
# tests the exact hex instead of just checking adjacency. | ||
{ASSERT ( | ||
[have_unit] | ||
id=alice | ||
x=12 | ||
y=2 | ||
[/have_unit] | ||
[have_unit] | ||
id=bob | ||
x=13 | ||
y=3 | ||
[/have_unit] | ||
)} | ||
|
||
{SUCCEED} | ||
[/event] | ||
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters