Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- test two tests a basic property of events - test three tests unit placement on the map in case of a collision
- Loading branch information
Showing
2 changed files
with
97 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,29 @@ | ||
# The purpose of this test is to check that a First in, First out | ||
# order of events is being respected. | ||
# | ||
# A variable X is set to 1 during prestart, and just after | ||
# a start event is registered which would set it to 0. | ||
# | ||
# Within the scenario tag, a start event is also registered | ||
# to return (X == 1). | ||
# | ||
# If the "nested" event runs before the outer level start event, | ||
# we fail the test. The outer event should run first because | ||
# all of the events in [scenario] are registered before any | ||
# of them is executed. | ||
|
||
{GENERIC_UNIT_TEST "unit_test_2" ( | ||
[event] | ||
name = prestart | ||
{VARIABLE X 1} | ||
[event] | ||
name = start | ||
{VARIABLE X 0} | ||
[/event] | ||
[/event] | ||
[event] | ||
name = start | ||
{RETURN ({VARIABLE_CONDITIONAL X equals 1})} | ||
[/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# The purpose of this test is to check that units spawned on | ||
# an occupied hex are placed at the nearest available vacant hex. | ||
# | ||
# Six blue grunts are spawned, one at 3,4 and five more at adjacent | ||
# hexes, leaving the southern hex 3,5 open. | ||
# Then a red grunt is spawned at 3,4. | ||
# We try to store a unit at 3,5, assert that we find one, and that | ||
# it is red. | ||
|
||
{GENERIC_UNIT_TEST "unit_test_3" ( | ||
[event] | ||
name = start | ||
[unit] | ||
x = 3 | ||
y = 4 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
[unit] | ||
x = 3 | ||
y = 3 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
[unit] | ||
x = 4 | ||
y = 3 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
[unit] | ||
x = 4 | ||
y = 4 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
|
||
[unit] | ||
x = 2 | ||
y = 3 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
[unit] | ||
x = 2 | ||
y = 4 | ||
type = Orcish Grunt | ||
side = 2 | ||
[/unit] | ||
[unit] | ||
x = 3 | ||
y = 4 | ||
type = Orcish Grunt | ||
side = 1 | ||
[/unit] | ||
|
||
[store_unit] | ||
variable = test | ||
[filter] | ||
x = 3 | ||
y = 5 | ||
[/filter] | ||
[/store_unit] | ||
{ASSERT ({VARIABLE_CONDITIONAL test.length equals 1})} | ||
{RETURN ({VARIABLE_CONDITIONAL test.side equals 1})} | ||
[/event] | ||
)} | ||
|