add fixed_lua_random_replay test

This commit is contained in:
Chris Beck 2014-05-13 21:27:17 -04:00
parent 07241761f8
commit 89f67d1a5d
2 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,62 @@
{GENERIC_UNIT_TEST "fixed_lua_random_replay_with_sync_choice" (
[event]
name = start
[allow_recruit]
side=1
type=Wose
[/allow_recruit]
[/event]
[event]
name = recruit
first_time_only = no
[kill]
x = $x1
y = $y1
animate=yes
[/kill]
[/event]
[event]
name = side 1 turn refresh
first_time_only=no
[lua]
code =<<
local result = wesnoth.synchronize_choice(
function()
return { value = math.random(200) }
end)
wesnoth.set_variable("rnd_num", result.value)
>>
[/lua]
[modify_side]
side = 1
gold = $rnd_num
[/modify_side]
[while]
{VARIABLE_CONDITIONAL rnd_num greater_than_equal_to 20}
[do]
[do_command]
[recruit]
type="Wose"
x,y=7,4
[from]
x,y=7,3
[/from]
[/recruit]
[/do_command]
{VARIABLE_OP rnd_num sub 20}
[/do]
[/while]
[end_turn]
[/end_turn]
[/event]
[event]
name = side 2 turn 30
{RETURN ([true][/true])}
[/event]
[event]
name = side 2 turn refresh
first_time_only=no
[end_turn]
[/end_turn]
[/event]
)}

View file

@ -8,6 +8,7 @@
1 test_assert_fail_two
2 empty_test
4 break_replay_with_lua_random
0 fixed_lua_random_replay_with_sync_choice
#
# WML API tests
#