wesnoth/wml_test_schedule
Steve Cotton 2b8e887bcf Fix [resistance_defaults] and [terrain_defaults] (issue #5308)
The bug introduced in fcd0ceda is fixed by ensuring that movetype::merge() is
called with the strings "movement_costs", "vision_costs" and "jamming_costs"
instead of "movement", "vision" and "jamming".

Both [terrain_defaults][movement] and [terrain_defaults][movement_costs] are
supported and equivalent, as added to the master branch in 3522eb2c.

These now work again:

    [resistance_defaults]
        id="special_res_for_test"
        default="30"
    [/resistance_defaults]

    [resistance_defaults]
        id="copy_of_arcane"
        default="(arcane)"
    [/resistance_defaults]

    [terrain_defaults]
        id="special_terrain_for_test"
        [movement]
            default="(swamp_water + 1)"
            orcishfoot="(swamp_water * 2)"
        [/movement]
    [/terrain_defaults]

Formulas can now access other parts of the movetype too, as this allowed the
code to be the same as in 1.15:

    [terrain_defaults]
        id="special_terrain_for_test"
        [movement_costs]
            default="(swamp_water + 1)"
            orcishfoot="(vision_costs.swamp_water * 2)"
        [/movement_costs]
    [/terrain_defaults]
    [terrain_defaults]
        id="special_terrain_for_test"
        [defense]
            default="(20 + 7 * movement_costs.special_terrain_for_test)"
        [/defense]
    [/terrain_defaults]

The formula handling will recognise "resistance", "movement_costs",
"vision_costs", "jamming_costs" and "defense". For [resistance_defaults], the
formula will recognise both "(arcane)" and "(resistance.arcane)" as equivalent,
similarly for [terrain_defaults] "(swamp_water)" is a shorthand for whichever
subtag is being patched.

A [terrain_defaults] tag may use data added in a previous [terrain_defaults],
as in the examples above where the second tag's [defense] is based on the first
tag's [movement_costs], this gives orcish grunts on the special terrain a 62%
chance to be hit. However, relying on data in the same [terrain_defaults] that
creates or changes it is unsupported - if the [movement_costs] and [defense]
were in a single [terrain_defaults] tag then the result would be implementation
defined, because no guarantee is made of the order in which the children of the
tag are processed.

The unit tests for [terrain_defaults] and [resistance_defaults] must stay
out-of-tree until we support some method of testing them without affecting the
core units' stats during other tests. The test added here is limited to
checking the ways that WML can read the stats, it's also a framework for the
out-of-tree parts to use.

This is a squashed cherry pick of these commits from 1.15:
* 72863e578b (the unit test)
* 0ba433203e
* 3522eb2c2a (adding the aliases)
* 0035b776d7 (fix for empty children)
2021-03-05 18:09:19 +01:00

231 lines
5.5 KiB
Text

#
# Sanity checks of the unit test system
#
0 test_return
1 test_return_fail
0 test_assert
1 test_assert_fail
1 test_assert_fail_two
2 empty_test
4 break_replay_with_lua_random
0 fixed_lua_random_replay_with_sync_choice
0 test_end_turn
#
# Security test
#
5 cve_2018_1999023
5 cve_2018_1999023_2
#
# Test Check Victory (If this isn't working other tests may have dubious value)
#
2 check_victory_basic_timeout
1 check_victory_basic_macro_check
0 check_victory_basic
1 check_victory_basic_fail
0 check_victory_basic_two
0 check_victory_basic_ai
1 check_victory_basic_ai_fail
0 check_victory_basic_ai_two
1 check_victory_one_no_units_fail_one
1 check_victory_one_no_units_fail_two
0 check_victory_one_no_units
1 check_victory_two_no_units_fail_one
1 check_victory_two_no_units_fail_two
0 check_victory_two_no_units
0 check_victory_always_one
0 check_victory_always_two
1 check_victory_always_no_units_fail
0 check_victory_always_no_units
1 check_victory_always_fail
1 check_victory_never_fail_one
1 check_victory_never_fail_two
1 check_victory_never_fail_three
0 check_victory_never_pass
1 check_victory_never_ai_fail
#
# WML API tests
#
0 two_plus_two
1 two_plus_two_fail
0 order_of_nested_events
0 test_clear_one
0 test_clear_two
0 test_unit_map
0 unit_spawns_at_nearest_vacant_hex
0 units_offmap_goto_recall
0 test_move
5 test_move_fail_1
5 test_move_fail_2
5 test_move_fail_3
5 test_move_fail_4
5 test_move_fail_5
5 test_move_fail_6
0 test_move_unit
0 sighted_events
1 sighted_events_fail
0 sighted_on_opponents_turn
1 sighted_on_opponents_turn_fail
0 move_skip_no_sighted_no_share_view
0 move_skip_ally_sighted_no_share_view
0 move_skip_all_sighted_no_share_view
0 move_skip_no_sighted_yes_share_view
0 move_skip_ally_sighted_yes_share_view
0 move_skip_all_sighted_yes_share_view
0 set_gold_in_prestart_one
0 set_gold_in_prestart_two
0 modify_turns_one
0 modify_turns_two
0 modify_turns_three
0 modify_turns_four
0 replace_schedule_prestart
0 modify_unit_facing
0 event_handlers_in_events_1
0 event_handlers_in_events_3
0 event_handlers_in_events_2
1 event_handlers_in_events_4
0 event_handlers_in_events_5
0 event_handlers_in_events_6
0 event_handlers_in_events_7
0 event_handlers_in_events_8
0 filter_vision
0 scatter_units
0 has_ally
0 xp_mod_1
0 xp_mod_2
0 xp_mod_3
0 test_role_1
0 test_role_2
0 test_role_3
0 test_role_lua
#
# LUA
#
0 lua_dofile
0 lua_require
0 lua_get_sides
0 test_wml_actions
0 test_wml_conditionals
0 lua_wml_tagnames
#
# Pathfinding
#
0 store_locations_one
# This test occasionally takes too long... (FIXME): 0 characterize_pathfinding_one
# The following tests segfault becasue of http://gna.org/bugs/?23188
0 characterize_pathfinding_reach_1
0 characterize_pathfinding_reach_2
0 characterize_pathfinding_reach_3
0 characterize_pathfinding_reach_4
0 characterize_pathfinding_reach_5
0 characterize_pathfinding_reach_6
0 characterize_pathfinding_reach_7
#
# Movement types, and modifying them
#
0 test_elf_movement
0 test_orc_movement
0 test_elf_fast_cave_movement
0 test_elf_fast_hills_movement
0 test_elf_fast_cave_and_hills_movement
0 test_orc_fast_cave_movement
0 test_orc_fast_forest_movement
0 test_elf_slow_cave_movement
0 test_elf_longsighted_movement
0 test_orc_longsighted_movement
0 test_elf_longsighted_fast_cave_movement
0 test_elf_fast_cave_longsighted_movement
0 test_elf_vision
0 test_elf_fast_cave_vision
0 test_elf_fast_hills_vision
0 test_elf_longsighted_cave_vision
0 test_elf_longsighted_cave_and_hills_vision
0 test_elf_longsighted_cave_slow_cave_vision
0 test_resistances
#
# Attack calculations & codepath tests
#
0 alice_kills_bob
0 bob_kills_alice_on_retal
0 alice_kills_bob_levelup
0 bob_kills_alice
0 alice_kills_bob_on_retal
0 alice_kills_bob_on_retal_levelup
0 test_grunt_tod_damage
0 test_time_area_damage
0 test_time_area_prestart
0 test_berzerk_firststrike
0 feeding
0 swarm_disables_upgrades
#
# Deterministic unit facing tests
0 recruit_facing_enemy_one
0 recruit_facing_enemy_two
0 recruit_facing_leader
0 recruit_facing_center
#
# Interface tests
#
0 test_wml_menu_items_1
1 test_wml_menu_items_2
0 test_wml_menu_items_3
#
# Conditional tests
#
0 check_conditionals_1
0 check_conditionals_2
# Standard Unit Filter tests
0 filter_this_unit_wml
0 filter_this_unit_tl
0 filter_this_unit_formula
0 filter_formula_unit
5 filter_formula_unit_error
# Interrupt tag tests
0 check_interrupts_break
0 check_interrupts_return
0 check_interrupts_continue
0 check_interrupts_break_global
0 check_interrupts_return_nested
0 check_interrupts_continue_global
0 check_interrupts_elseif
0 check_interrupts_case
# For-loop tests
0 forloop_all_zero
0 forloop_step_zero
0 forloop_once_positive
0 forloop_once_negative
0 forloop_twice_matched
0 forloop_twice_unmatched
0 forloop_empty_array
0 forloop_array
0 forloop_array_reverse
0 forloop_step_large_positive
0 forloop_step_large_negative
0 for_defaults
0 for_start2
0 for_end2
0 for_end2_step2
0 for_end-2
0 for_end-2_step-2
# AI Config Parsing tests
0 test_basic_simplified_aspect
0 test_basic_abbreviated_aspect
0 test_basic_standard_aspect
0 test_basic_composite_aspect
0 test_basic_lua_aspect
0 test_basic_composite_facet
0 test_basic_lua_facet
0 test_basic_composite_default_facet
0 test_basic_lua_default_facet
# AI Modification tests
0 test_modify_ai_delete_facet
0 test_modify_ai_change_facet
0 test_modify_ai_replace_facet
0 test_modify_ai_add_facet
0 test_modify_ai_change_default_facet
0 test_modify_ai_nested_facets
0 test_modify_ai_composite_default_facets
0 test_modify_ai_change_aspect
# Event tests
0 order_of_variable_events1
1 order_of_variable_events2
0 event_name_variable_substitution