refactor break_replay tests into one file
This commit is contained in:
parent
8d161347bc
commit
4e16a998a2
2 changed files with 22 additions and 68 deletions
|
@ -9,7 +9,8 @@
|
|||
# For each turn its about 50-50 not to go out of sync, so the chance not to
|
||||
# go out of sync should be roughly less than one in a billion.
|
||||
|
||||
{GENERIC_UNIT_TEST "break_replay_with_lua_random" (
|
||||
#define TEST_BREAK_REPLAY ID GET_RND_NUM
|
||||
{GENERIC_UNIT_TEST {ID} (
|
||||
[event]
|
||||
name = start
|
||||
[allow_recruit]
|
||||
|
@ -29,11 +30,7 @@
|
|||
[event]
|
||||
name = side 1 turn refresh
|
||||
first_time_only=no
|
||||
[lua]
|
||||
code =<<
|
||||
wesnoth.set_variable("rnd_num", math.random(200))
|
||||
>>
|
||||
[/lua]
|
||||
{GET_RND_NUM}
|
||||
[modify_side]
|
||||
side = 1
|
||||
gold = $rnd_num
|
||||
|
@ -67,3 +64,22 @@
|
|||
[/end_turn]
|
||||
[/event]
|
||||
)}
|
||||
#enddef
|
||||
|
||||
{TEST_BREAK_REPLAY "break_replay_with_lua_random"
|
||||
([lua]
|
||||
code =<<
|
||||
wesnoth.set_variable("rnd_num", math.random(200))
|
||||
>>
|
||||
[/lua])}
|
||||
|
||||
{TEST_BREAK_REPLAY "fixed_lua_random_replay_with_sync_choice"
|
||||
([lua]
|
||||
code =<<
|
||||
local result = wesnoth.synchronize_choice(
|
||||
function()
|
||||
return { value = math.random(200) }
|
||||
end)
|
||||
wesnoth.set_variable("rnd_num", result.value)
|
||||
>>
|
||||
[/lua])}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
{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]
|
||||
)}
|
Loading…
Add table
Reference in a new issue