1# Test that clearing multiple variables works, also that
2# the WML `_G` analogue works.
3
4{GENERIC_UNIT_TEST "test_clear_one" (
5    [event]
6        name = start
7
8        {VARIABLE A 5}
9        {VARIABLE B 10}
10
11        {CLEAR_VARIABLE A}
12
13        [lua]
14            code = << local a,b,c = false,false,false
15			  for k,v in pairs(wml.all_variables) do
16			    if k == "A" then
17			      a = true
18			    elseif (k == "B") and (v == 10) then
19			      b = true
20			    elseif (k == "C") then
21			      c = true
22			    end
23			  end
24			  wml.variables["result"] = (not a) and b and (not c) >>
25        [/lua]
26
27        {RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
28    [/event]
29)}
30
31{GENERIC_UNIT_TEST "test_clear_two" (
32    [event]
33        name = start
34
35        {VARIABLE A 5}
36        {VARIABLE B 10}
37        {VARIABLE C 20}
38
39        {CLEAR_VARIABLE A,C}
40
41        [lua]
42            code = << local a,b,c = false,false,false
43			  for k,v in pairs(wml.all_variables) do
44			    if k == "A" then
45			      a = true
46			    elseif (k == "B") and (v == 10) then
47			      b = true
48			    elseif (k == "C") then
49			      c = true
50			    end
51			  end
52			  wml.variables["result"] = (not a) and b and (not c) >>
53        [/lua]
54
55        {RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
56    [/event]
57)}
58