Skip to content

Commit

Permalink
Added a new unit test for [role]
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Jun 10, 2015
1 parent f290a86 commit 1b239aa
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
92 changes: 92 additions & 0 deletions data/test/scenarios/test_role_types.cfg
@@ -0,0 +1,92 @@
{GENERIC_UNIT_TEST "test_role_1" (
[event]
name=prestart
# create a bunch of units in side 1 recall list
{UNIT 1 Ghost recall recall (id=wrong_0)}
{UNIT 1 Shadow recall recall (id=wrong_1)}
{UNIT 1 Spectre recall recall (id=correct)}
{UNIT 1 Wraith recall recall (id=wrong_2)}
{UNIT 1 Nightgaunt recall recall (id=wrong_3)}
[/event]

[event]
name=start

[role]
role=advisor
side=1
type=Spectre,Nightgaunt,Wraith,Shadow,Ghost
[/role]

[recall]
role=advisor
[/recall]

{ASSERT (
[have_unit]
side=1
role=advisor
type=Spectre
id=correct
search_recall_list=no
[/have_unit]
)}

{RETURN ([true][/true])}
[/event]
)}

{GENERIC_UNIT_TEST "test_role_2" (
[event]
name=prestart
# create a bunch of units on field for side 2
{UNIT 2 "Troll Whelp" 13 2 (id=wrong_0)}
{UNIT 2 Troll 12 2 (id=wrong_1)}
{UNIT 2 "Troll Shaman" 14 2 (id=correct)}
{UNIT 2 "Troll Warrior" 12 3 (id=wrong_2)}
{UNIT 2 "Troll Rocklobber" 14 3 (id=wrong_3)}
[/event]

[event]
name=start

[role]
role=smart
side=2
type=Troll Shaman,Troll Warrior,Troll Rocklobber,Troll,Troll Whelp
[/role]

{ASSERT (
[have_unit]
side=2
role=smart
type=Troll Shaman
id=correct
search_recall_list=no
[/have_unit]
)}

{RETURN ([true][/true])}
[/event]
)}

{GENERIC_UNIT_TEST "test_role_3" (
[event]
name=start

[role]
role=dummy
side=3
[/role]

{ASSERT (
[have_unit]
role=dummy
count=0
search_recall_list=yes
[/have_unit]
)}

{RETURN ([true][/true])}
[/event]
)}
3 changes: 3 additions & 0 deletions wml_test_schedule
Expand Up @@ -87,6 +87,9 @@
0 xp_mod_1
0 xp_mod_2
0 xp_mod_3
0 test_role_1
0 test_role_2
0 test_role_3
#
# LUA
#
Expand Down

0 comments on commit 1b239aa

Please sign in to comment.