wesnoth/data/test/macros/shroud.cfg
Steve Cotton 5f1d46513a Reindent unit tests and unit test macros
This doesn't cover all of the unit tests, it's the result of running wmlindent
on all of them and then reviewing whether the changes were bugs in the test, or
whether they're bugs in wmlindent.

Note: there are two cve_2018_1999023 tests. The other one needs to be treated
as a binary file, but the one changed here is plain text that loads its attack
from a separate file.

The change in start_position_generic.cfg doesn't seem good, but it's not
particularly bad and it's what wmlindent currently does.
2023-01-20 02:28:54 +01:00

69 lines
1.6 KiB
INI

#textdomain wesnoth-test
#define OBJECT_HALF_VISION
[object]
[effect]
apply_to=vision
increase=-50%
[/effect]
[/object]
#enddef
#define TEST_SHROUD_SCEN ID EVENTS
[test]
name = _ "Unit Test " + {ID}
map_file=test/maps/generic_unit_test.map
id = {ID}
is_unit_test = yes
random_start_time = no
#is_unit_test = yes
{DAWN}
[side]
side=1
controller=human
name = _ "Alice"
type = Elvish Archer
id=alice
shroud=yes
[modifications]
{OBJECT_HALF_VISION}
[/modifications]
[/side]
[side]
side=2
controller=ai
name = _ "Bob"
type = Orcish Grunt
id=bob
shroud=yes
[modifications]
{OBJECT_HALF_VISION}
[/modifications]
[/side]
{EVENTS}
[/test]
#enddef
#define ASSERT_SHROUDED FILTER STATE
[lua]
code=<<
local locs = wesnoth.map.find(wml.get_child(..., 'filter'))
local state = (...).state
for _,loc in ipairs(locs) do
local x, y = loc[1], loc[2]
unit_test.assert_equal(wesnoth.sides.is_shrouded(1, loc), state, string.format('shroud check at (%d,%d)', loc[1], loc[2]))
end
>>
[args]
[filter]
include_borders=yes
{FILTER}
[/filter]
state={STATE}
[/args]
[/lua]
#enddef