refactor sighted events test to be one file
This commit is contained in:
parent
af4b671266
commit
bf2dda129c
4 changed files with 56 additions and 295 deletions
|
@ -3,14 +3,16 @@
|
|||
# and discovers an orcish grunt.
|
||||
# We pass if the elvish archer is the discoverer, and the
|
||||
# variable "sighted_should_trigger" is set.
|
||||
# A companion test checks that we fail if we don't set that
|
||||
# Companion tests check what happens if the orc is discovered
|
||||
# on the elf's turn, and also that we fail if we dont set the
|
||||
# flag.
|
||||
|
||||
#define TEST_SIGHTED_EVENTS_SCEN ID BOB_CONDITION SET_FLAG
|
||||
[test]
|
||||
name = "Unit Test sighted_events"
|
||||
name = "Unit Test {ID}"
|
||||
map_data = "{test/maps/sighted_events.map}"
|
||||
turns = 4
|
||||
id = sighted_events
|
||||
id = {ID}
|
||||
random_start_time = no
|
||||
|
||||
{DAWN}
|
||||
|
@ -55,21 +57,46 @@
|
|||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#Bob moves down, then up.
|
||||
#Bob moves either down, then up (unseen), or left, then right (seen)
|
||||
[event]
|
||||
name = side 2 turn 1 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=3,4,5
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=5,4,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[if]
|
||||
{BOB_CONDITION}
|
||||
[then]
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=3,4,5
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=5,4,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/then]
|
||||
[else]
|
||||
[if]
|
||||
{SET_FLAG}
|
||||
[then]
|
||||
{VARIABLE sighted_should_trigger yes}
|
||||
[/then]
|
||||
[/if]
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,15,14
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=14,15,16
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/else]
|
||||
[/if]
|
||||
[/event]
|
||||
|
||||
#Alice discovers Bob.
|
||||
|
@ -82,7 +109,12 @@
|
|||
[/move]
|
||||
[/do_command]
|
||||
#With the next stop Bob should be visible.
|
||||
{VARIABLE sighted_should_trigger yes}
|
||||
[if]
|
||||
{SET_FLAG}
|
||||
[then]
|
||||
{VARIABLE sighted_should_trigger yes}
|
||||
[/then]
|
||||
[/if]
|
||||
[do_command]
|
||||
[move]
|
||||
x=8,9
|
||||
|
@ -105,3 +137,10 @@
|
|||
[/end_turn]
|
||||
[/event]
|
||||
[/test]
|
||||
#enddef
|
||||
|
||||
{TEST_SIGHTED_EVENTS_SCEN sighted_events ([true][/true]) ([true][/true])}
|
||||
{TEST_SIGHTED_EVENTS_SCEN sighted_events_fail ([true][/true]) ([false][/false])}
|
||||
{TEST_SIGHTED_EVENTS_SCEN sighted_on_opponents_turn ([false][/false]) ([true][/true])}
|
||||
{TEST_SIGHTED_EVENTS_SCEN sighted_on_opponents_turn_fail ([false][/false]) ([false][/false])}
|
||||
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
# This is a companion test to "sighted_events".
|
||||
# It checks that when a certain flag is not set,
|
||||
# we do indeed fail the test.
|
||||
|
||||
[test]
|
||||
name = "Unit Test sighted_events_fail"
|
||||
map_data = "{test/maps/sighted_events.map}"
|
||||
turns = 4
|
||||
id = sighted_events_fail
|
||||
random_start_time = no
|
||||
|
||||
{DAWN}
|
||||
|
||||
[side]
|
||||
side=1
|
||||
controller=human
|
||||
name = "Alice"
|
||||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=yes
|
||||
[/side]
|
||||
[side]
|
||||
side=2
|
||||
controller=human
|
||||
name = "Bob"
|
||||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
[/side]
|
||||
|
||||
[event]
|
||||
name = prestart
|
||||
{VARIABLE sighted_should_trigger no}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name = sighted
|
||||
{ASSERT ({VARIABLE_CONDITIONAL unit.id equals bob})}
|
||||
{ASSERT ({VARIABLE_CONDITIONAL second_unit.id equals alice})}
|
||||
{RETURN ({VARIABLE_CONDITIONAL sighted_should_trigger boolean_equals yes})}
|
||||
[/event]
|
||||
|
||||
#Alice moves towards Bob.
|
||||
[event]
|
||||
name = side 1 turn 1 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=1,2,3,4,5,6,7
|
||||
y=3,3,3,3,3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#Bob moves down, then up.
|
||||
[event]
|
||||
name = side 2 turn 1 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=3,4,5
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,16,16
|
||||
y=5,4,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#Alice discovers Bob.
|
||||
[event]
|
||||
name = side 1 turn 2 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=7,8
|
||||
y=3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
#With the next stop Bob should be visible.
|
||||
#{VARIABLE sighted_should_trigger yes} <-- With this line commented out the test should fail
|
||||
[do_command]
|
||||
[move]
|
||||
x=8,9
|
||||
y=3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#If we got this far without triggering sighted, we fail the test.
|
||||
[event]
|
||||
name = side 2 turn 2
|
||||
{RETURN ([false][/false])}
|
||||
[/event]
|
||||
|
||||
#This makes the sides pass their turns, when the other events have taken place.
|
||||
[event]
|
||||
name = side turn
|
||||
first_time_only = no
|
||||
[end_turn]
|
||||
[/end_turn]
|
||||
[/event]
|
||||
[/test]
|
|
@ -1,90 +0,0 @@
|
|||
# This test checks that sighted events are being triggered
|
||||
# at the appropriate time. An elvish archer moves towards
|
||||
# an orcish grunt, then the orcish grunt moves towards and
|
||||
# is discovered by the archer, without being discovered itself.
|
||||
# We pass if the elvish archer is the discoverer, and the
|
||||
# variable "sighted_should_trigger" is set.
|
||||
# A companion test checks that we fail if we don't set that
|
||||
# flag.
|
||||
|
||||
[test]
|
||||
name = "Unit Test sighted_on_opponents_turn"
|
||||
map_data = "{test/maps/sighted_events.map}"
|
||||
turns = 4
|
||||
id = sighted_on_opponents_turn
|
||||
random_start_time = no
|
||||
|
||||
{DAWN}
|
||||
|
||||
[side]
|
||||
side=1
|
||||
controller=human
|
||||
name = "Alice"
|
||||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=yes
|
||||
[/side]
|
||||
[side]
|
||||
side=2
|
||||
controller=human
|
||||
name = "Bob"
|
||||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
[/side]
|
||||
|
||||
[event]
|
||||
name = prestart
|
||||
{VARIABLE sighted_should_trigger no}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name = sighted
|
||||
{ASSERT ({VARIABLE_CONDITIONAL unit.id equals bob})}
|
||||
{ASSERT ({VARIABLE_CONDITIONAL second_unit.id equals alice})}
|
||||
{RETURN ({VARIABLE_CONDITIONAL sighted_should_trigger boolean_equals yes})}
|
||||
[/event]
|
||||
|
||||
#Alice moves towards Bob.
|
||||
[event]
|
||||
name = side 1 turn 1 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=1,2,3,4,5,6,7
|
||||
y=3,3,3,3,3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#Bob moves to be seen by alice, but doesnt see her himself.
|
||||
[event]
|
||||
name = side 2 turn 1 refresh
|
||||
{VARIABLE sighted_should_trigger yes}
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,15,14
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=14,15,16
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#If we got this far without triggering sighted, we fail the test.
|
||||
[event]
|
||||
name = side 1 turn 2
|
||||
{RETURN ([false][/false])}
|
||||
[/event]
|
||||
|
||||
#This makes the sides pass their turns, when the other events have taken place.
|
||||
[event]
|
||||
name = side turn
|
||||
first_time_only = no
|
||||
[end_turn]
|
||||
[/end_turn]
|
||||
[/event]
|
||||
[/test]
|
|
@ -1,85 +0,0 @@
|
|||
# This is a companion test to "sighted_on_opponents_turn".
|
||||
# It checks that when a certain flag is not set,
|
||||
# we do indeed fail the test.
|
||||
|
||||
[test]
|
||||
name = "Unit Test sighted_on_opponents_turn_fail"
|
||||
map_data = "{test/maps/sighted_events.map}"
|
||||
turns = 4
|
||||
id = sighted_on_opponents_turn_fail
|
||||
random_start_time = no
|
||||
|
||||
{DAWN}
|
||||
|
||||
[side]
|
||||
side=1
|
||||
controller=human
|
||||
name = "Alice"
|
||||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=yes
|
||||
[/side]
|
||||
[side]
|
||||
side=2
|
||||
controller=human
|
||||
name = "Bob"
|
||||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
[/side]
|
||||
|
||||
[event]
|
||||
name = prestart
|
||||
{VARIABLE sighted_should_trigger no}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name = sighted
|
||||
{ASSERT ({VARIABLE_CONDITIONAL unit.id equals bob})}
|
||||
{ASSERT ({VARIABLE_CONDITIONAL second_unit.id equals alice})}
|
||||
{RETURN ({VARIABLE_CONDITIONAL sighted_should_trigger boolean_equals yes})}
|
||||
[/event]
|
||||
|
||||
#Alice moves towards Bob.
|
||||
[event]
|
||||
name = side 1 turn 1 refresh
|
||||
[do_command]
|
||||
[move]
|
||||
x=1,2,3,4,5,6,7
|
||||
y=3,3,3,3,3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#Bob moves to be seen by alice, but doesnt see her himself.
|
||||
[event]
|
||||
name = side 2 turn 1 refresh
|
||||
#{VARIABLE sighted_should_trigger yes} <-- With this line commented the test should fail.
|
||||
[do_command]
|
||||
[move]
|
||||
x=16,15,14
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[do_command]
|
||||
[move]
|
||||
x=14,15,16
|
||||
y=3,3,3
|
||||
[/move]
|
||||
[/do_command]
|
||||
[/event]
|
||||
|
||||
#If we got this far without triggering sighted, we fail the test.
|
||||
[event]
|
||||
name = side 1 turn 2
|
||||
{RETURN ([false][/false])}
|
||||
[/event]
|
||||
|
||||
#This makes the sides pass their turns, when the other events have taken place.
|
||||
[event]
|
||||
name = side turn
|
||||
first_time_only = no
|
||||
[end_turn]
|
||||
[/end_turn]
|
||||
[/event]
|
||||
[/test]
|
Loading…
Add table
Reference in a new issue