Skip to content

Commit

Permalink
add unit test for berzerk + firststrike interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed May 17, 2014
1 parent 4e16a99 commit 86fea3c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
44 changes: 44 additions & 0 deletions data/test/scenarios/test_berzerk_firststrike.cfg
@@ -0,0 +1,44 @@
# Tests the order of hits that results when a spearman is attacked by an ulfserker.
# If first strike and berzerk interact correctly, should repeat DADADAA

#define ADD_SYMBOL S
{VARIABLE SEQUENCE ("$SEQUENCE|"+"{S}")}
{VARIABLE_OP LEN string_length $SEQUENCE}
{IF_VAR LEN equals 29 (
[then]
{RETURN ({VARIABLE_CONDITIONAL SEQUENCE equals "DADADAADADADAADADADAADADADAAD"})}
[/then]
)}
#enddef

{GENERIC_UNIT_TEST "test_berzerk_firststrike" (
[event]
name = attacker misses, attacker hits
first_time_only=no
{ADD_SYMBOL "A"}
[/event]
[event]
name = defender misses, defender hits
first_time_only=no
{ADD_SYMBOL "D"}
[/event]

[event]
name = start
{VARIABLE SEQUENCE ""}
{UNIT 1 "Dwarvish Ulfserker" 7 4 (hitpoints=100)}
{UNIT 2 "Spearman" 8 4 (hitpoints=100)}
[do_command]
[attack]
weapon = 0
defender_weapon = 0
[source]
x,y=7,4
[/source]
[destination]
x,y=8,4
[/destination]
[/attack]
[/do_command]
[/event]
)}
3 changes: 2 additions & 1 deletion wml_test_schedule
Expand Up @@ -37,6 +37,7 @@
0 move_skip_ally_sighted_yes_share_view
0 move_skip_all_sighted_yes_share_view
#
# Attack calculations tests
# Attack calculations & codepath tests
#
0 test_grunt_tod_damage
0 test_berzerk_firststrike

0 comments on commit 86fea3c

Please sign in to comment.