wesnoth/data/test/macros/wml_unit_test_macros.cfg
Steve Cotton c5dec73784 Unit tests: make separate files for each starting position
Turn the 4 side setup of the firststrike_and_laststrike test into a macro
called `COMMON_KEEP_A_B_C_D`for reuse in other tests.

The comment for `GENERIC_UNIT_TEST` gets a couple of extra paragraphs.

All the files get wmlindent run on them, which reindents `FAIL_IF_NOT`.

The main reason for having these is separate files is Git's fuzzy-patch
matching when merging and rebasing. Having large blocks of identical text
in `wml_unit_test_macros.cfg` can mean the wrong section gets patched.
2022-04-18 04:48:53 +02:00

78 lines
1.7 KiB
INI

#textdomain wesnoth-test
#define RETURN X
[if]
[variable]
name=ended
boolean_not_equals=yes
[/variable]
[then]
[if]
{X}
[then]
{VARIABLE ended yes}
[endlevel]
test_result=pass
linger_mode = yes
[/endlevel]
[/then]
[else]
[test_condition]
result=no
{X}
[/test_condition]
{VARIABLE ended yes}
[endlevel]
test_result=fail
linger_mode = yes
[/endlevel]
[/else]
[/if]
[/then]
[/if]
#enddef
#define ASSERT X
[if]
[variable]
name=ended
boolean_not_equals=yes
[/variable]
[then]
[if]
{X}
[else]
[test_condition]
result=no
{X}
[/test_condition]
{VARIABLE ended yes}
[endlevel]
test_result=fail
linger_mode = yes
[/endlevel]
[/else]
[/if]
[/then]
[/if]
#enddef
#define FAIL
{RETURN ([false][/false])}
#enddef
#define SUCCEED
{RETURN ([true][/true])}
#enddef
#define FAIL_IF_NOT FLAG NOT_EQUALS
[if]
[variable]
name={FLAG}
not_equals={NOT_EQUALS}
[/variable]
[then]
{FAIL}
[/then]
[/if]
#enddef