From 89f67d1a5d0af156021ce2ad39c66addc4dd4100 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Tue, 13 May 2014 21:27:17 -0400 Subject: [PATCH] add fixed_lua_random_replay test --- ...xed_lua_random_replay_with_sync_choice.cfg | 62 +++++++++++++++++++ wml_test_schedule | 1 + 2 files changed, 63 insertions(+) create mode 100644 data/test/scenarios/fixed_lua_random_replay_with_sync_choice.cfg diff --git a/data/test/scenarios/fixed_lua_random_replay_with_sync_choice.cfg b/data/test/scenarios/fixed_lua_random_replay_with_sync_choice.cfg new file mode 100644 index 00000000000..877b1644df0 --- /dev/null +++ b/data/test/scenarios/fixed_lua_random_replay_with_sync_choice.cfg @@ -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] +)} diff --git a/wml_test_schedule b/wml_test_schedule index 0494f0c590b..b5acb5c1012 100644 --- a/wml_test_schedule +++ b/wml_test_schedule @@ -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 #