Refactor test helpers and clean up random failures #39228
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: none
Purpose of change
Several tests were failing when executed with
tests/cata_test --order rand
with various seeds, due to stale effects or insufficient cleanup/reset between test cases. This fixes several of them.Describe the solution
item_tname_test.cpp
)clear_character
map_helpers.cpp
fromvehicle_power_test.cpp
:remove_all_vehicles
toclear_vehicles
build_test_map
, and use the sharedbuild_test_map
fromvehicle_efficiency_test.cpp
andvehicle_drag_test.cpp
[slow]
tag to all test cases that took more than 1 second to executetests/cata_test ~[slow]~[.]
REQUIRE_FALSE
andCHECK_FALSE
where appropriate (instead of!
)Describe alternatives you've considered
Inevitable entropy
Testing
Iterative
tests/cata_test --order rand --rng-seed X
, sometimes with~[slow]~[.]
to run only the "fast" tests.Additional context
There are bound to be more that still fail with random seeds, but this knocks out 80% of the ones I could find.