1#textdomain wesnoth
2#define RETURN X
3    [if]
4        [variable]
5            name=ended
6            boolean_not_equals=yes
7        [/variable]
8        [then]
9            [if]
10                {X}
11                [then]
12                    {VARIABLE ended yes}
13                    [endlevel]
14                        result=victory
15                        linger_mode = yes
16                    [/endlevel]
17                [/then]
18                [else]
19                    [test_condition]
20                        result=no
21                        {X}
22                    [/test_condition]
23                    {VARIABLE ended yes}
24                    [endlevel]
25                        result=defeat
26                        linger_mode = yes
27                    [/endlevel]
28                [/else]
29            [/if]
30        [/then]
31    [/if]
32#enddef
33
34#define ASSERT X
35    [if]
36        [variable]
37            name=ended
38            boolean_not_equals=yes
39        [/variable]
40        [then]
41            [if]
42                {X}
43                [else]
44                    [test_condition]
45                        result=no
46                        {X}
47                    [/test_condition]
48                    {VARIABLE ended yes}
49                    [endlevel]
50                        result=defeat
51                        linger_mode = yes
52                    [/endlevel]
53                [/else]
54            [/if]
55        [/then]
56    [/if]
57#enddef
58
59#define GENERIC_UNIT_TEST NAME CONTENT
60    [test]
61        name = "Unit Test " + {NAME}
62        map_data = "{test/maps/generic_unit_test.map}"
63        turns = -1
64        id = {NAME}
65        is_unit_test = yes
66
67        {DAWN}
68
69        [side]
70            side=1
71            controller=human
72            name = "Alice"
73            type = Elvish Archer
74            id=alice
75        [/side]
76        [side]
77            side=2
78            controller=human
79            name = "Bob"
80            type = Orcish Grunt
81            id=bob
82        [/side]
83
84        {CONTENT}
85    [/test]
86#enddef
87
88#define FAIL
89    {RETURN ([false][/false])}
90#enddef
91
92#define SUCCEED
93    {RETURN ([true][/true])}
94#enddef
95