Add a unit test for wesnoth.create_side
This commit is contained in:
parent
855b51521c
commit
16f93cd24c
2 changed files with 75 additions and 0 deletions
73
data/test/scenarios/test_create_side.cfg
Normal file
73
data/test/scenarios/test_create_side.cfg
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{GENERIC_UNIT_TEST "test_create_side" (
|
||||||
|
[event]
|
||||||
|
name=start
|
||||||
|
|
||||||
|
# Sanity-check the preconditions
|
||||||
|
[store_side]
|
||||||
|
variable=sides
|
||||||
|
[/store_side]
|
||||||
|
{ASSERT {VARIABLE_CONDITIONAL sides.length equals 2}}
|
||||||
|
|
||||||
|
[lua]
|
||||||
|
code=<< wesnoth.create_side() -- >>
|
||||||
|
[/lua]
|
||||||
|
[store_side]
|
||||||
|
variable=sides
|
||||||
|
[/store_side]
|
||||||
|
{ASSERT {VARIABLE_CONDITIONAL sides.length equals 3}}
|
||||||
|
|
||||||
|
# Try making some modifications to the side
|
||||||
|
[unit]
|
||||||
|
side=3
|
||||||
|
name="Charlie"
|
||||||
|
type=Chocobone
|
||||||
|
id=charlie
|
||||||
|
canrecruit=yes
|
||||||
|
x,y=13,4
|
||||||
|
[/unit]
|
||||||
|
|
||||||
|
[lua]
|
||||||
|
code=<< wesnoth.create_side() -- >>
|
||||||
|
[/lua]
|
||||||
|
[store_side]
|
||||||
|
variable=sides
|
||||||
|
[/store_side]
|
||||||
|
{ASSERT {VARIABLE_CONDITIONAL sides.length equals 4}}
|
||||||
|
|
||||||
|
# Ally 1 with 4 and 2 with 3, like the default on Isar's Cross
|
||||||
|
[modify_side]
|
||||||
|
side=3
|
||||||
|
team_name=$sides[1].team_name
|
||||||
|
[/modify_side]
|
||||||
|
[modify_side]
|
||||||
|
side=4
|
||||||
|
team_name=$sides[0].team_name
|
||||||
|
[/modify_side]
|
||||||
|
[unit]
|
||||||
|
side=4
|
||||||
|
name="Dave"
|
||||||
|
type=Dwarvish Fighter
|
||||||
|
id=dave
|
||||||
|
canrecruit=yes
|
||||||
|
x,y=7,4
|
||||||
|
[/unit]
|
||||||
|
|
||||||
|
[store_side]
|
||||||
|
[enemy_of]
|
||||||
|
side=1
|
||||||
|
[/enemy_of]
|
||||||
|
variable=sides
|
||||||
|
[/store_side]
|
||||||
|
{ASSERT {VARIABLE_CONDITIONAL sides.length equals 2}}
|
||||||
|
|
||||||
|
[store_side]
|
||||||
|
[allied_with]
|
||||||
|
side=1
|
||||||
|
[/allied_with]
|
||||||
|
variable=sides
|
||||||
|
[/store_side]
|
||||||
|
{ASSERT {VARIABLE_CONDITIONAL sides.length equals 2}}
|
||||||
|
|
||||||
|
{SUCCEED}
|
||||||
|
[/event]
|
||||||
|
)}
|
|
@ -225,6 +225,8 @@
|
||||||
0 test_modify_ai_nested_facets
|
0 test_modify_ai_nested_facets
|
||||||
0 test_modify_ai_composite_default_facets
|
0 test_modify_ai_composite_default_facets
|
||||||
0 test_modify_ai_change_aspect
|
0 test_modify_ai_change_aspect
|
||||||
|
# Changing the number of sides
|
||||||
|
0 test_create_side
|
||||||
# Event tests
|
# Event tests
|
||||||
0 order_of_variable_events1
|
0 order_of_variable_events1
|
||||||
1 order_of_variable_events2
|
1 order_of_variable_events2
|
||||||
|
|
Loading…
Add table
Reference in a new issue