add wml unit tests two and three
- test two tests a basic property of events - test three tests unit placement on the map in case of a collision
This commit is contained in:
parent
0797abd9ea
commit
634ee2d1d8
2 changed files with 97 additions and 0 deletions
29
data/test/scenarios/unit_test_2.cfg
Normal file
29
data/test/scenarios/unit_test_2.cfg
Normal file
|
@ -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]
|
||||
)}
|
||||
|
68
data/test/scenarios/unit_test_3.cfg
Normal file
68
data/test/scenarios/unit_test_3.cfg
Normal file
|
@ -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]
|
||||
)}
|
||||
|
Loading…
Add table
Reference in a new issue