diff --git a/data/test/scenarios/unit_test_2.cfg b/data/test/scenarios/unit_test_2.cfg new file mode 100644 index 000000000000..465c8b72c6f6 --- /dev/null +++ b/data/test/scenarios/unit_test_2.cfg @@ -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] +)} + diff --git a/data/test/scenarios/unit_test_3.cfg b/data/test/scenarios/unit_test_3.cfg new file mode 100644 index 000000000000..f37e4c55adc3 --- /dev/null +++ b/data/test/scenarios/unit_test_3.cfg @@ -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] +)} +