Add tests for character biometrics (BMI, BMR, weight, kcal) #39266
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: Infrastructure "Add tests for character BMI / kcal / weight"
Purpose of change
To improve test coverage of character health stats
Describe the solution
Adds a few test cases covering behavior of low-level health-related functions including:
Character::get_bmi()
Character::get_kcal_percent()
Character::get_max_healthy()
Character::get_weight_string()
Character::height()
Character::bodyweight()
Character::metabolic_rate_base()
Charactrer::get_bmr()
Test cases check the following:
+200
for normal weight range-200
for "very obese" and largerDescribe alternatives you've considered
Would eventually like to add some tests of the
healthy
andhealthy_mod
character attributes, and their effects on healing rate, resistance to disease, mending broken limbs and so forth.Testing
Using
tests/cata_test [biometrics]
Additional context
7 new test cases, 351 assertions, runs in 0.001 sec
Note: These tests only check current behavior of the game code; whether that behavior is truly realistic and desirable is outside the scope of this PR, and I did not do more than superficial research on these formulas. Running these same BMR tests against the revised calculations in #36862 gives different results which may actually be more correct in terms of realism. If so, these tests should be easy to adjust.