forked from wesnoth/wesnoth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for ability[filter][filter_adjacent_location]adjacent,…
…count= The Wiki docs say that count= takes a number or numerical range, and is true if the number of matches in adjacent locations matches that range. However, the implementations that are specific to using it in ability filters are buggy, and returns false if any location in the adjacent= set doesn't match. This behavior should be fixed for 1.20, but fixing it for 1.18 could cause Out Of Sync errors if any ability used this.
- Loading branch information
1 parent
0e21864
commit be284c4
Showing
4 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...test/scenarios/wml_tests/FilterWML/filter_filter_adjacent_location_count_three_active.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#textdomain wesnoth-test | ||
|
||
##### | ||
# API(s) being tested: ability[filter][filter_adjacent_location]adjacent,count= | ||
## | ||
# Actions: | ||
# Give Alice an ability specialX, which is only active if exactly three of adjacents terrains are Gg. | ||
# Give Charlie and Dave has specialY. | ||
# Test whether the ability is active. | ||
## | ||
# Expected end state: | ||
# specialX should be active. | ||
##### | ||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "filter_filter_adjacent_location_count_three_active" ( | ||
[event] | ||
name=start | ||
|
||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to=new_ability | ||
[abilities] | ||
[damage] | ||
id=specialX | ||
name=_ "specialX" | ||
description=_ "specialX is active if and only if 3 terrains hexes are Gg" | ||
value=100 | ||
apply_to=self | ||
[filter] | ||
[filter_adjacent_location] | ||
adjacent=n,ne,se,s,sw,nw | ||
count=3 | ||
terrain=Gg | ||
[/filter_adjacent_location] | ||
[/filter] | ||
[/damage] | ||
[/abilities] | ||
[/effect] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[/object] | ||
|
||
{ASSERT ( | ||
[have_unit] | ||
ability_id_active=specialX | ||
[/have_unit] | ||
)} | ||
|
||
{SUCCEED} | ||
[/event] | ||
)} |
52 changes: 52 additions & 0 deletions
52
.../test/scenarios/wml_tests/FilterWML/filter_filter_adjacent_location_count_zero_active.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#textdomain wesnoth-test | ||
|
||
##### | ||
# API(s) being tested: ability[filter][filter_adjacent_location]adjacent,count= | ||
## | ||
# Actions: | ||
# Give Alice an ability specialX, which is only active if zero of the adjacent terrains are Ww. | ||
# No unit has specialY. | ||
# Test whether the ability is active. | ||
## | ||
# Expected end state: | ||
# specialX should be active. | ||
##### | ||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "filter_filter_adjacent_location_count_zero_active" ( | ||
[event] | ||
name=start | ||
|
||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to=new_ability | ||
[abilities] | ||
[damage] | ||
id=specialX | ||
name=_ "specialX" | ||
description=_ "specialX is active if and only if 0 terrains hexes are Ww" | ||
value=100 | ||
apply_to=self | ||
[filter] | ||
[filter_adjacent_location] | ||
adjacent=n,ne,se,s,sw,nw | ||
count=0 | ||
terrain=Ww | ||
[/filter_adjacent_location] | ||
[/filter] | ||
[/damage] | ||
[/abilities] | ||
[/effect] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[/object] | ||
|
||
{ASSERT ( | ||
[have_unit] | ||
ability_id_active=specialX | ||
[/have_unit] | ||
)} | ||
|
||
{SUCCEED} | ||
[/event] | ||
)} |
52 changes: 52 additions & 0 deletions
52
...est/scenarios/wml_tests/FilterWML/filter_filter_adjacent_location_count_zero_inactive.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
##### | ||
# API(s) being tested: ability[filter][filter_adjacent_location]adjacent,count= | ||
## | ||
# Actions: | ||
# Give Alice an ability specialX, which is only active if zero of the adjacent terrains are Gg. | ||
# Give Bob the ability specialY. | ||
# Test whether specialX ability is active. | ||
## | ||
# Expected end state: | ||
# specialX isn't active. | ||
##### | ||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "filter_filter_adjacent_location_count_zero_inactive" ( | ||
[event] | ||
name=start | ||
|
||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to=new_ability | ||
[abilities] | ||
[damage] | ||
id=specialX | ||
name=_ "specialX" | ||
description=_ "specialX is active if and only if 0 terrains hexes are Gg" | ||
value=100 | ||
apply_to=self | ||
[filter] | ||
[filter_adjacent_location] | ||
adjacent=n,ne,se,s,sw,nw | ||
count=0 | ||
terrain=Gg | ||
[/filter_adjacent_location] | ||
[/filter] | ||
[/damage] | ||
[/abilities] | ||
[/effect] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[/object] | ||
|
||
{ASSERT ( | ||
[not] | ||
[have_unit] | ||
ability_id_active=specialX | ||
[/have_unit] | ||
[/not] | ||
)} | ||
|
||
{SUCCEED} | ||
[/event] | ||
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters