Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
newfrenchy83 committed Dec 22, 2024
1 parent e1203f3 commit 2d88b5b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,40 @@
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

#define TEST_DAMAGE_MULTIPLY_FRACTION TEST_CASE_INDEX BASE_VALUE MULTIPLIER EXPECTED
{COMMON_KEEP_A_B_UNIT_TEST "damage_multiply_fraction_{TEST_CASE_INDEX}" (
[event]
name = start

[modify_unit]
[filter]
[/filter]
[effect]
apply_to = attack
set_damage={BASE_VALUE}
[/effect]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE damage (multiply={MULTIPLIER}) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]

{ATTACK_AND_VALIDATE {EXPECTED} (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#enddef

# baseline test with integer result
{TEST_DAMAGE_MULTIPLY_FRACTION 0 10 1 10}
{TEST_DAMAGE_MULTIPLY_FRACTION 1 10 1.1 11}
# rounding at middle point - round towards base value
{TEST_DAMAGE_MULTIPLY_FRACTION 2 1 1.5 2}
{TEST_DAMAGE_MULTIPLY_FRACTION 3 2 0.75 2}
{TEST_DAMAGE_MULTIPLY_FRACTION 4_2 1 1.51 2}
{TEST_DAMAGE_MULTIPLY_FRACTION 5_1 2 0.74 1}

#undef TEST_DAMAGE_MULTIPLY_FRACTION
6 changes: 6 additions & 0 deletions wml_test_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,12 @@
0 damage_multiply
0 damage_multiply_divide
0 damage_multiply_fraction
0 damage_multiply_fraction_0
0 damage_multiply_fraction_1
0 damage_multiply_fraction_
0 damage_multiply_fraction_3
0 damage_multiply_fraction_4_2
0 damage_multiply_fraction_5_1
0 damage_no_value
0 damage_sub
0 damage_sub_divide
Expand Down

0 comments on commit 2d88b5b

Please sign in to comment.