More unit test documentation.
This commit is contained in:
parent
5ffa031e8e
commit
a2491d3aa4
16 changed files with 748 additions and 95 deletions
|
@ -5,9 +5,20 @@
|
|||
# - through [attacks]
|
||||
# - through [effect] increase_attacks
|
||||
|
||||
#####
|
||||
# API(s) being tested: [swarm]swarm_attacks_max=,[swarm]swarm_attacks_min=
|
||||
##
|
||||
# Actions:
|
||||
# Give bob a swarms special as well as attacks specials to change the number of strikes.
|
||||
# Have bob and alice attack each other.
|
||||
##
|
||||
# Expected end state:
|
||||
# alice takes 1 damage since the swarms special overrides the other weapon specials modifying the number of strikes bob gets.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "swarm_disables_upgrades" (
|
||||
[event]
|
||||
name=start
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
|
@ -15,6 +26,7 @@
|
|||
hitpoints=100
|
||||
attacks_left=1
|
||||
[/modify_unit]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
[effect]
|
||||
|
@ -43,6 +55,7 @@
|
|||
id=bob
|
||||
[/filter]
|
||||
[/object]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
[effect]
|
||||
|
@ -64,6 +77,7 @@
|
|||
id=alice
|
||||
[/filter]
|
||||
[/object]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
[filter]
|
||||
|
@ -82,17 +96,20 @@
|
|||
variable=a
|
||||
kill=yes
|
||||
[/store_unit]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
variable=b
|
||||
[/store_unit]
|
||||
|
||||
[unstore_unit]
|
||||
variable=a
|
||||
find_vacant=yes
|
||||
x,y=$b.x,$b.y
|
||||
[/unstore_unit]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=alice
|
||||
|
@ -112,20 +129,24 @@
|
|||
[/destination]
|
||||
[/attack]
|
||||
[/do_command]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=alice
|
||||
[/filter]
|
||||
variable=a
|
||||
[/store_unit]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
variable=b
|
||||
[/store_unit]
|
||||
|
||||
{ASSERT ({VARIABLE_CONDITIONAL a.hitpoints equals 99})}
|
||||
{ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 90})}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
# This unit test is used for verify what 'add' and 'sub' attributes work in [leadership] abilities
|
||||
# but also what 'cumulative=yes' is fixed.
|
||||
|
||||
#####
|
||||
# API(s) being tested: [leadership]add=,[leadership]value=,[leadership]cumulative=
|
||||
##
|
||||
# Actions:
|
||||
# Give alice two pairs of leadership abilities that affects himself. One pair of leaderships uses the value attribute with cumulative=yes; the other uses the add attribute with cumulative=no.
|
||||
# Give alice an attack damage of 12.
|
||||
# Have alice and bob fight.
|
||||
##
|
||||
# Expected end state:
|
||||
# alice gains a total attack bonus of 75%, which makes alice's damage 21.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_add_in_leadership_abilities" (
|
||||
[event]
|
||||
name=start
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
|
@ -10,30 +23,35 @@
|
|||
hitpoints=100
|
||||
attacks_left=1
|
||||
[/modify_unit]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
[effect]
|
||||
apply_to=new_ability
|
||||
[abilities]
|
||||
# base leadership
|
||||
[leadership]
|
||||
id=leadership_cum
|
||||
value=25
|
||||
cumulative=yes
|
||||
affect_self=yes
|
||||
[/leadership]
|
||||
[leadership]#this value must be added to other leadership_cum
|
||||
# added since id is the same, even though it uses the value attribute, since cumulative=yes
|
||||
[leadership]
|
||||
id=leadership_cum
|
||||
value=25
|
||||
cumulative=yes
|
||||
affect_self=yes
|
||||
[/leadership]
|
||||
# added because it uses the add attribute with a different id
|
||||
[leadership]
|
||||
id=leadership_pos
|
||||
add=25
|
||||
cumulative=no
|
||||
affect_self=yes
|
||||
[/leadership]
|
||||
[leadership]#this value musn't be added because already leadership_pos to value=25
|
||||
# not added since it uses the same id with a lower value for the add attribute and cumulative=no
|
||||
[leadership]
|
||||
id=leadership_pos
|
||||
add=15
|
||||
cumulative=no
|
||||
|
@ -58,33 +76,24 @@
|
|||
# Move Alice next to Bob
|
||||
[move_unit]
|
||||
id=alice
|
||||
to_location=2
|
||||
to_x=12
|
||||
to_y=3
|
||||
[/move_unit]
|
||||
|
||||
# Fight
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
variable=b
|
||||
[/store_unit]
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=alice
|
||||
[/filter]
|
||||
variable=a
|
||||
[/store_unit]
|
||||
[do_command]
|
||||
[attack]
|
||||
weapon=0
|
||||
defender_weapon=0
|
||||
[source]
|
||||
x,y=$a.x,$a.y
|
||||
x,y=12,3
|
||||
[/source]
|
||||
[destination]
|
||||
x,y=$b.x,$b.y
|
||||
x,y=13,3
|
||||
[/destination]
|
||||
[/attack]
|
||||
[/do_command]
|
||||
|
||||
# Check results
|
||||
[store_unit]
|
||||
[filter]
|
||||
|
@ -92,16 +101,30 @@
|
|||
[/filter]
|
||||
variable=b
|
||||
[/store_unit]
|
||||
#the final damage must be damage_value +(damage_value*(2*leadership_cum + highest leadership_pos))
|
||||
# 12 + 12*(2*0.25 + 0.25) = 21. It must be remain 100hp-21=79hp
|
||||
|
||||
# the final damage must be damage_value + (damage_value * ((leadership_cum + leadership_cum) + highest leadership_pos))
|
||||
# 12 + (12 * (0.25 + 0.25 + 0.25)) = 21. 100 hp - 21 = 79 hp.
|
||||
{ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 79})}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [leadership]sub=
|
||||
##
|
||||
# Actions:
|
||||
# Give bob a leadership ability that halves bob's damage.
|
||||
# Give bob a base damage of 60.
|
||||
# Have bob and alice fight.
|
||||
##
|
||||
# Expected end state:
|
||||
# alice takes 30 damage.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_sub_in_leadership_abilities" (
|
||||
[event]
|
||||
name=start
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
|
@ -109,6 +132,7 @@
|
|||
hitpoints=100
|
||||
attacks_left=1
|
||||
[/modify_unit]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
[effect]
|
||||
|
@ -139,33 +163,24 @@
|
|||
# Move Alice next to Bob
|
||||
[move_unit]
|
||||
id=alice
|
||||
to_location=2
|
||||
to_x=12
|
||||
to_y=3
|
||||
[/move_unit]
|
||||
|
||||
# Fight
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
variable=b
|
||||
[/store_unit]
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=alice
|
||||
[/filter]
|
||||
variable=a
|
||||
[/store_unit]
|
||||
[do_command]
|
||||
[attack]
|
||||
weapon=0
|
||||
defender_weapon=0
|
||||
[source]
|
||||
x,y=$a.x,$a.y
|
||||
x,y=12,3
|
||||
[/source]
|
||||
[destination]
|
||||
x,y=$b.x,$b.y
|
||||
x,y=13,3
|
||||
[/destination]
|
||||
[/attack]
|
||||
[/do_command]
|
||||
|
||||
# Check results
|
||||
[store_unit]
|
||||
[filter]
|
||||
|
@ -173,7 +188,9 @@
|
|||
[/filter]
|
||||
variable=a
|
||||
[/store_unit]
|
||||
|
||||
{ASSERT ({VARIABLE_CONDITIONAL a.hitpoints equals 70})}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Tests that "assert true, return true" works.
|
||||
# This is a sanity check of the unit testing mechanism.
|
||||
# These tests are general sanity checks of the unit testing mechanisms.
|
||||
|
||||
#####
|
||||
# API(s) being tested: [test_condition][true],[if][true]
|
||||
##
|
||||
# Expected end state:
|
||||
# Tests that "assert true, return true" works (macros).
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_assert" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -8,8 +14,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Tests that "assert false, return true" fails.
|
||||
# This is a sanity check of the unit testing mechanism.
|
||||
#####
|
||||
# API(s) being tested: [test_condition][not][true]
|
||||
##
|
||||
# Expected end state:
|
||||
# Tests that "assert false, return true" fails (macros).
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_assert_fail" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -18,8 +28,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Tests that "assert true, return false" fails.
|
||||
# This is a sanity check of the unit testing mechanism.
|
||||
#####
|
||||
# API(s) being tested: [test_condition][true],[if][not][true]
|
||||
##
|
||||
# Expected end state:
|
||||
# Tests that "assert true, return false" fails (macros).
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_assert_fail_two" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -28,8 +42,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Tests that "assert true, pass" works.
|
||||
# This is a sanity check of the unit testing mechanism.
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert(),unit_test.succeed()
|
||||
##
|
||||
# Expected end state:
|
||||
# Tests that "assert true, pass" works (lua).
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -42,8 +60,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert()
|
||||
##
|
||||
# Expected end state:
|
||||
# Tests that "assert false, return true" works.
|
||||
# This is a sanity check of the unit testing mechanism.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_fail" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -56,7 +78,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Sanity check that a fail() in a fired event causes the test to fail
|
||||
#####
|
||||
# API(s) being tested: unit_test.fail(),[fire_event]
|
||||
##
|
||||
# Expected end state:
|
||||
# A fail() in a fired event causes the test to fail.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_fail_in_fired_event" (
|
||||
[event]
|
||||
id = fail_event
|
||||
|
@ -79,7 +106,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Test the comparison assertions from the Lua unit_test module
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_equal(),unit_test.assert_not_equal(),unit_test.assert_greater(),unit_test.assert_less(),unit_test.assert_in_range(),unit_test.assert_approx_equal(),unit_test.assert_contains()
|
||||
##
|
||||
# Expected end state:
|
||||
# All string and numeric comparison assertions succeed.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -101,6 +133,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_equal()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail1" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -113,6 +151,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_not_equal()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -125,6 +169,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_less()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail3" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -137,6 +187,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_equal()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail4" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -149,6 +205,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_not_equal()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail5" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -161,6 +223,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_greater()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail6" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -173,6 +241,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_less()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail7" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -185,6 +259,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_in_range()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail8" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -197,6 +277,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_approx_equal()
|
||||
##
|
||||
# Expected end state:
|
||||
# The assert successfully fails.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_compare_fail9" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -209,6 +295,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_nothrow()
|
||||
##
|
||||
# Expected end state:
|
||||
# No error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors1" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -221,6 +313,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_nothrow()
|
||||
##
|
||||
# Expected end state:
|
||||
# An error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -233,6 +331,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws()
|
||||
##
|
||||
# Expected end state:
|
||||
# No error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors3" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -245,6 +349,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws()
|
||||
##
|
||||
# Expected end state:
|
||||
# An error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors4" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -257,6 +367,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws_with()
|
||||
##
|
||||
# Expected end state:
|
||||
# The expected error is not thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors5" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -269,6 +385,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws_with()
|
||||
##
|
||||
# Expected end state:
|
||||
# The expected error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors6" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -281,6 +403,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws_with()
|
||||
##
|
||||
# Expected end state:
|
||||
# The expected error is not thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors7" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -293,6 +421,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws_with()
|
||||
##
|
||||
# Expected end state:
|
||||
# The expected error is thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors8" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -305,6 +439,12 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: unit_test.assert_throws_with()
|
||||
##
|
||||
# Expected end state:
|
||||
# The expected error is not thrown.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_assert_errors9" (
|
||||
[event]
|
||||
name=start
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Tests the order of hits that results when a spearman is attacked by an ulfserker.
|
||||
# If first strike and berzerk interact correctly, should repeat DADADAA
|
||||
# If first strike and berserk interact correctly, should repeat DADADAA
|
||||
|
||||
#define ADD_SYMBOL S
|
||||
{VARIABLE SEQUENCE ("$SEQUENCE|"+"{S}")}
|
||||
|
@ -11,7 +11,17 @@
|
|||
)}
|
||||
#enddef
|
||||
|
||||
{GENERIC_UNIT_TEST "test_berzerk_firststrike" (
|
||||
#####
|
||||
# API(s) being tested: [berserk],[firststrike]
|
||||
##
|
||||
# Actions:
|
||||
# Spawn an Ulfserker and a Spearman.
|
||||
# Have the Ulfserker attack the Spearman.
|
||||
##
|
||||
# Expected end state:
|
||||
# The sequence of strikes has the Spearman striking first for each round of combat in the berserk.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_berserk_firststrike" (
|
||||
[event]
|
||||
name = attacker misses, attacker hits
|
||||
first_time_only=no
|
|
@ -83,48 +83,250 @@
|
|||
[/event]
|
||||
#enddef
|
||||
|
||||
#define TEST_KILL_SIDES_TWO_THREE ID ID_yes ID_no ID_yesno DC1 DC2 DC3 DC4 CON VWED
|
||||
{TEST_CHECK_VICTORY_SCEN ({ID} {ID_yes}) {DC1} {DC2} {DC3} {DC4} {CON} {VWED} (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
|
||||
{TEST_CHECK_VICTORY_SCEN ({ID} {ID_no}) {DC1} {DC2} {DC3} {DC4} {CON} {VWED} (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
|
||||
{TEST_CHECK_VICTORY_SCEN ({ID} {ID_yesno}) {DC1} {DC2} {DC3} {DC4} {CON} {VWED} (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
#enddef
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=
|
||||
##
|
||||
# Expected end state:
|
||||
# The test times out because no sides lose their leader.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_timeout "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" ()}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails because no sides lose their leader.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_macro_check "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" ({FAIL_IF_NO_END ()})}
|
||||
|
||||
{TEST_KILL_SIDES_TWO_THREE check_victory_basic "" "_fail" "_two" "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes"}
|
||||
{TEST_KILL_SIDES_TWO_THREE check_victory_basic_ai "" "_fail" "_two" "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "ai" "yes"}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leaders of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the non-leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match does not end with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_fail "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill all units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_two "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
|
||||
{TEST_KILL_SIDES_TWO_THREE check_victory_one_no_units "_fail_one" "_fail_two" "" "no_leader_left" "no_units_left" "no_leader_left" "no_leader_left" "human" "yes"}
|
||||
{TEST_KILL_SIDES_TWO_THREE check_victory_two_no_units "_fail_one" "_fail_two" "" "no_leader_left" "no_units_left" "no_units_left" "no_leader_left" "human" "yes"}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Sides 2 and 3 are AI controlled.
|
||||
# Kill the leaders of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_ai "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "ai" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Sides 2 and 3 are AI controlled.
|
||||
# Kill the non-leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match does not end with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_ai_fail "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "ai" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Sides 2 and 3 are AI controlled.
|
||||
# Kill all units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends with victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_basic_ai_two "no_leader_left" "no_leader_left" "no_leader_left" "no_leader_left" "ai" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leaders of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since to defeat side 2 all units need to be killed.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_one_no_units_fail_one "no_leader_left" "no_units_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the non-leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 2 has units left and side 3 has its leader left.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_one_no_units_fail_two "no_leader_left" "no_units_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill all units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_one_no_units "no_leader_left" "no_units_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since sides 2 and 3 have units left.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_two_no_units_fail_one "no_leader_left" "no_units_left" "no_units_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the non-leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since sides 2 and 3 have units left.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_two_no_units_fail_two "no_leader_left" "no_units_left" "no_units_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill all units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_two_no_units "no_leader_left" "no_units_left" "no_units_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_always_one "always" "no_leader_left" "no_leader_left" "always" "human" "yes" ()}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill side 4's leader.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_always_two "always" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "4" "yes"}
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill side 4's leader.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 4 has units left.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_always_no_units_fail "always" "no_leader_left" "no_leader_left" "no_units_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "4" "yes"}
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill all of side 4's units.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_always_no_units "always" "no_leader_left" "no_leader_left" "no_units_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
|
@ -133,14 +335,82 @@
|
|||
)}
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 4 has units left.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_always_fail "always" "no_leader_left" "no_leader_left" "no_leader_left" "human" "yes" ({FAIL_IF_NO_END ()})}
|
||||
|
||||
{TEST_KILL_SIDES_TWO_THREE check_victory_never_fail "_one" "_two" "_three" "no_leader_left" "never" "no_leader_left" "no_leader_left" "human" "yes"}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leader of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 2 can never be defeated.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_never_fail_one "no_leader_left" "never" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "yes"} #kill leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the non-leader units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 2 can never be defeated and side 3 has its leader.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_never_fail_two "no_leader_left" "never" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "2,3" "no"} #kill units but not leaders of side 2,3
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill all units of sides 2 and 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails since side 2 can never be defeated.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_never_fail_three "no_leader_left" "never" "no_leader_left" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
[kill]
|
||||
side=2,3
|
||||
[/kill]
|
||||
)}
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leaders of sides 1 and 4.
|
||||
##
|
||||
# Expected end state:
|
||||
# The match ends in victory.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_never_pass "no_leader_left" "always" "never" "no_leader_left" "human" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "1,4" "yes"}
|
||||
)}
|
||||
)}
|
||||
#####
|
||||
# API(s) being tested: [side]defeat_condition=,[test]victory_when_enemies_defeated=
|
||||
##
|
||||
# Actions:
|
||||
# Kill the leaders of sides 1 and 4.
|
||||
##
|
||||
# Expected end state:
|
||||
# The test fails by defeat since sides 2 and 3 are controlled by the AI.
|
||||
#####
|
||||
{TEST_CHECK_VICTORY_SCEN check_victory_never_ai_fail "no_leader_left" "always" "never" "no_leader_left" "ai" "yes" (
|
||||
{FAIL_IF_NO_END (
|
||||
{KILL_SIDE "1,4" "yes"}
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
# Test that clearing multiple variables works, also that
|
||||
# the WML `_G` analogue works.
|
||||
# Test that clearing multiple variables works, also that the WML `_G` analogue (aka wml.all_variables) works.
|
||||
|
||||
#####
|
||||
# API(s) being tested: [clear_variable]
|
||||
##
|
||||
# Actions:
|
||||
# Use WML to set variables A and B.
|
||||
# Clear variable A with WML.
|
||||
##
|
||||
# Expected end state:
|
||||
# The variable A doesn't exist.
|
||||
# The variable B exists with the expected value.
|
||||
# The variable C doesn't exist.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_clear_one" (
|
||||
[event]
|
||||
name = start
|
||||
|
@ -28,6 +39,18 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [clear_variable]
|
||||
##
|
||||
# Actions:
|
||||
# Use WML to set variables A, B, and C.
|
||||
# Clear variables A and C with WML.
|
||||
##
|
||||
# Expected end state:
|
||||
# The variable A doesn't exist.
|
||||
# The variable B exists with the expected value.
|
||||
# The variable C doesn't exist.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_clear_two" (
|
||||
[event]
|
||||
name = start
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
#textdomain wesnoth-test
|
||||
|
||||
#####
|
||||
# API(s) being tested: wesnoth.sides.create()
|
||||
##
|
||||
# Actions:
|
||||
# Create side 3.
|
||||
# Give a unit to side 3.
|
||||
# Create side 4.
|
||||
# Give a unit to side 4.
|
||||
# Make side 4 allied with side 1.
|
||||
# Make side 2 allied with side 3.
|
||||
##
|
||||
# Expected end state:
|
||||
# The new sides are created.
|
||||
# The sides are made to be allied as expected.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_create_side" (
|
||||
[event]
|
||||
name=start
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
#####
|
||||
# API(s) being tested: N/A
|
||||
##
|
||||
# Actions:
|
||||
# Attempt to load bytecode.bin to bypass the lua sandbox.
|
||||
##
|
||||
# Expected end state:
|
||||
# The insecure execution of the bytecode is prevented.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "cve_2018_1999023" (
|
||||
[lua]
|
||||
code = << pcall(function() wesnoth.dofile("test/scenarios/bytecode.bin") end) >>
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
#####
|
||||
# API(s) being tested: wesnoth.dofile()
|
||||
##
|
||||
# Actions:
|
||||
# Execute a lua file with wesnoth.dofile() and assign its result to the a, b, c, and d variables.
|
||||
##
|
||||
# Expected end state:
|
||||
# The variables a, b, c, and d all have the expected value.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "lua_dofile" (
|
||||
[event]
|
||||
name = prestart
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
# This series of tests checks that the C++ unit class handles changes to movement and vision points correctly.
|
||||
|
||||
#define ASSERT_ALICE_STAT stat relation value
|
||||
#define ASSERT_ALICE_STAT STAT RELATION VALUE
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=alice
|
||||
[/filter]
|
||||
variable=temp_for_stat_assert
|
||||
[/store_unit]
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.{stat} {relation} {value}}}
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.{STAT} {RELATION} {VALUE}}}
|
||||
[clear_variable]
|
||||
name=temp_for_stat_assert
|
||||
[/clear_variable]
|
||||
#enddef
|
||||
|
||||
#define ASSERT_VISION_EFFECTIVELY relation value
|
||||
#define ASSERT_VISION_EFFECTIVELY RELATION VALUE
|
||||
# Similar to "ASSERT_ALICE_STAT vision", but with manual handling for the -1 value. When using [store_unit], we see the raw value of -1, even though pathfinding calculations would interpret that as "same value as max_moves".
|
||||
[store_unit]
|
||||
[filter]
|
||||
|
@ -26,10 +26,10 @@
|
|||
[if]
|
||||
{VARIABLE_CONDITIONAL temp_for_stat_assert.vision equals -1}
|
||||
[then]
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.max_moves {relation} {value}}}
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.max_moves {RELATION} {VALUE}}}
|
||||
[/then]
|
||||
[else]
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.vision {relation} {value}}}
|
||||
{ASSERT {VARIABLE_CONDITIONAL temp_for_stat_assert.vision {RELATION} {VALUE}}}
|
||||
[/else]
|
||||
[/if]
|
||||
[clear_variable]
|
||||
|
@ -37,8 +37,17 @@
|
|||
[/clear_variable]
|
||||
#enddef
|
||||
|
||||
# Test that changing the max_moves affects the vision points, assuming that the vision points haven't been explicitly set to a separate value.
|
||||
# This test would also pass on 1.14, movement always affected vision in this case.
|
||||
#####
|
||||
# API(s) being tested: [effect]apply_to=movement
|
||||
##
|
||||
# Actions:
|
||||
# Change alice's max_moves to different values.
|
||||
##
|
||||
# Expected end state:
|
||||
# Vision matches max_moves, even when max_moves is changed.
|
||||
# Jamming remains 0.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "effect_move_affects_vision" (
|
||||
[event]
|
||||
name = side 1 turn 1
|
||||
|
@ -134,8 +143,18 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Test that changing the max_moves has a corresponding effect on vision points, even when the vision points have already been set to a separate value.
|
||||
# This behavior is different to that in 1.14.
|
||||
#####
|
||||
# API(s) being tested: [effect]apply_to=movement,[effect]apply_to=vision
|
||||
##
|
||||
# Actions:
|
||||
# Set alice's vision to a different value than the max_moves.
|
||||
# Change alice's max_moves to different values.
|
||||
##
|
||||
# Expected end state:
|
||||
# Vision changes by the same amount that max_moves changes despite being different values.
|
||||
# Jamming remains 0.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "effect_move_separated_vision" (
|
||||
[event]
|
||||
name = side 1 turn 1
|
||||
|
@ -219,7 +238,16 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Test that apply_to=vision works
|
||||
#####
|
||||
# API(s) being tested: [effect]apply_to=vision
|
||||
##
|
||||
# Actions:
|
||||
# Set alice's vision to a different value than max_moves.
|
||||
##
|
||||
# Expected end state:
|
||||
# The vision and max_moves values are different.
|
||||
# Jamming is still 0.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "effect_vision" (
|
||||
[event]
|
||||
name = side 1 turn 1
|
||||
|
@ -259,7 +287,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
# Test that apply_to_vision=no will avoid changing vision
|
||||
#####
|
||||
# API(s) being tested: [effect]apply_to=movement,[effect]apply_to_vision=no
|
||||
##
|
||||
# Actions:
|
||||
# Change alice's max_moves without changing her vision.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice's max_moves changes, but alice's vision does not.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "effect_move_ignores_vision" (
|
||||
[event]
|
||||
name = side 1 turn 1
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# This test checks that [end_turn] is working.
|
||||
|
||||
#####
|
||||
# API(s) being tested: [end_turn]
|
||||
##
|
||||
# Actions:
|
||||
# End the turn.
|
||||
##
|
||||
# Expected end state:
|
||||
# The turn ends.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_end_turn" (
|
||||
[event]
|
||||
name = start
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
# [for] executes once with all for_defaults
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with no attributes.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop executes once.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_defaults" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -13,6 +22,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with only start=2.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop executes once.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_start2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -27,6 +45,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with only end=2.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop executes three times.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_end2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -41,6 +68,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with only end=2 and step=2.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop executes twice.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_end2_step2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -56,6 +92,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with only end=-2.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop is not executed.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_end-2" (
|
||||
[event]
|
||||
name=start
|
||||
|
@ -70,6 +115,15 @@
|
|||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [for]
|
||||
##
|
||||
# Actions:
|
||||
# Use the [for] tag with only end=-2 and step=-2.
|
||||
##
|
||||
# Expected end state:
|
||||
# The contents of the loop executes twice.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "for_end-2_step-2" (
|
||||
[event]
|
||||
name=start
|
||||
|
|
|
@ -35,6 +35,15 @@
|
|||
{ASSERT {VARIABLE_CONDITIONAL damage equals {EXPECTED_DAMAGE}}}
|
||||
#enddef
|
||||
|
||||
#####
|
||||
# API(s) being tested: N/A
|
||||
##
|
||||
# Actions:
|
||||
# Have an Orcish Grunt attack an Elvish Archer during afternoon (day), dusk, and first watch (night).
|
||||
##
|
||||
# Expected end state:
|
||||
# The Elvish Archer takes the expected amount of damage from the Orcish Grunt depending on the current time of day.
|
||||
#####
|
||||
[test]
|
||||
name = _ "Unit Test test_grunt_tod_damage"
|
||||
map_file=test/maps/test_grunt_tod_damage.map
|
||||
|
@ -93,10 +102,15 @@
|
|||
[/event]
|
||||
[/test]
|
||||
|
||||
# Same test but using [time_area] tags instead of default_schedule
|
||||
# to produce the damage changes
|
||||
#
|
||||
|
||||
#####
|
||||
# API(s) being tested: [time_area]
|
||||
##
|
||||
# Actions:
|
||||
# Have an Orcish Grunt attack an Elvish Archer during afternoon (day), dusk, and first watch (night) created by [time_area] rather than passing turns.
|
||||
##
|
||||
# Expected end state:
|
||||
# The Elvish Archer takes the expected amount of damage from the Orcish Grunt depending on the current time area.
|
||||
#####
|
||||
[test]
|
||||
name = _ "Unit Test test_time_area_damage"
|
||||
map_file=test/maps/test_grunt_tod_damage.map
|
||||
|
@ -167,8 +181,15 @@
|
|||
[/event]
|
||||
[/test]
|
||||
|
||||
# Test a time area declared in prestart event
|
||||
|
||||
#####
|
||||
# API(s) being tested: [time_area]
|
||||
##
|
||||
# Actions:
|
||||
# Create a time area of First Watch in a prestart event.
|
||||
##
|
||||
# Expected end state:
|
||||
# The Elvish Archer takes the expected amount of damage from the Orcish Grunt.
|
||||
#####
|
||||
[test]
|
||||
name = _ "Unit Test test_time_area_prestart"
|
||||
map_file=test/maps/test_grunt_tod_damage.map
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
#
|
||||
# This test is lax about the exact values, it's meant to test the API layer
|
||||
# rather than detect someone altering the exact hue in team-colors.cfg.
|
||||
|
||||
#####
|
||||
# API(s) being tested: wesnoth.colors
|
||||
##
|
||||
# Expected end state:
|
||||
# The values returned for red, green, blue, and gold are correct.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_colors" (
|
||||
[event]
|
||||
name = prestart
|
||||
|
@ -52,6 +59,13 @@
|
|||
# Test that the pango_color data works.
|
||||
#
|
||||
# For simplicity, these string comparisons use the exact values.
|
||||
|
||||
#####
|
||||
# API(s) being tested: wesnoth.colors.pango_colors
|
||||
##
|
||||
# Expected end state:
|
||||
# The colors red, blue, and gold return the expected hex color strings.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "test_lua_colors_hexadecimal" (
|
||||
[event]
|
||||
name = prestart
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
|
||||
# Test that an error message in Lua includes the value of the tag's name key
|
||||
|
||||
#####
|
||||
# API(s) being tested: [lua]name=
|
||||
##
|
||||
# Expected end state:
|
||||
# The error text contains the value of the name attribute.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST test_lua_name (
|
||||
[event]
|
||||
name=start
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
0 test_grunt_tod_damage
|
||||
0 test_time_area_damage
|
||||
0 test_time_area_prestart
|
||||
0 test_berzerk_firststrike
|
||||
0 test_berserk_firststrike
|
||||
0 feeding_on_living
|
||||
0 feeding_on_dead
|
||||
0 firststrike_and_laststrike
|
||||
|
|
Loading…
Add table
Reference in a new issue