-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests for get_hit, get_dodge and related functions #39491
Conversation
6134549
to
aaf566d
Compare
Several of these tests are randomly failing, even with the same execution order. Common failures are when avatar mysteriously has 1/4 the initial dodge level (causing all others in that section to fail), or when one of the four monsters in the "grab" test are checked for positioning, for example: Using bash to run the same tests multiple times:
The Travis CI run on this PR had a new failure I've not seen locally: Note, this |
Using |
I believe the random failures can be traced to a problem with the |
I'm adding a melee stats counter in #39564 which may or may not simplify some of these tests. |
1c2a866
to
f86b7a6
Compare
f86b7a6
to
b56d325
Compare
CI test failures here in Now I just need to figure out how on earth having a cleaner starting avatar is causing crafting failure... |
Use dummy.setpos instead of g->u in the place_player helper function. Global `g->u` avatar instance is implicit in `place_player`; we want to set the position of the `dummy` instance, not necessarily `g->u`. Also reset speed and bonuses in clear_character.
Includes new unit tests for Character, player, and monster functions get_hit_base, get_dodge_base, and get_dodge.
b56d325
to
72b6276
Compare
Summary
SUMMARY: Infrastructure "Add unit tests for get_hit, get_dodge and related functions"
Purpose of change
Improved test coverage of melee aspects
Describe the solution
Adds
tests/melee_dodge_hit_test.cpp
with unit tests focused on these methods fromget_hit_base
get_dodge_base
get_dodge
(in progress)get_dodge
Describe alternatives you've considered
Unexplored mystery
Testing
tests/cata_test [melee][hit],[melee][dodge]
Additional context
This went through some rough (and I do mean rough) drafts, but I have rebased it into two clean commits now.