Skip to content
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

Set stored kcal to healthy kcal for testing #46941

Merged
merged 7 commits into from
Feb 6, 2021
Merged
2 changes: 2 additions & 0 deletions tests/player_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void clear_character( player &dummy )
// This sets HP to max, clears addictions and morale,
// and sets hunger, thirst, fatigue and such to zero
dummy.environmental_revert_effect();
Comment on lines 72 to 74
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone have any idea whether this originally intended to reset calories along with hunger "and such"?

// However, the above does not set stored kcal
dummy.set_stored_kcal( dummy.get_healthy_kcal() );

dummy.empty_skills();
dummy.martial_arts_data->clear_styles();
Expand Down
21 changes: 12 additions & 9 deletions tests/weary_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ TEST_CASE( "weary_assorted_tasks", "[weary][activities]" )

SECTION( "Light tasks" ) {
INFO( "\nFirst Aid 8 hours:" );
clear_avatar();
INFO( guy.debug_weary_info() );
weariness_events info = do_activity( desk_8h );
INFO( info.summarize() );
Expand All @@ -66,7 +67,7 @@ TEST_CASE( "weary_assorted_tasks", "[weary][activities]" )
INFO( info.summarize() );
INFO( guy.debug_weary_info() );
REQUIRE( !info.empty() );
CHECK( info.transition_minutes( 0, 1, 115_minutes ) == Approx( 115 ).margin( 5 ) );
CHECK( info.transition_minutes( 0, 1, 120_minutes ) == Approx( 120 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 2, 255_minutes ) == Approx( 255 ).margin( 5 ) );
CHECK( info.transition_minutes( 2, 3, 360_minutes ) == Approx( 360 ).margin( 5 ) );
CHECK( info.transition_minutes( 3, 4, 470_minutes ) == Approx( 470 ).margin( 5 ) );
Expand Down Expand Up @@ -118,6 +119,7 @@ TEST_CASE( "weary_recovery", "[weary][activities]" )

SECTION( "Heavy tasks" ) {
INFO( "\nDigging Pits 8 hours, then waiting 8:" );
clear_avatar();
INFO( guy.debug_weary_info() );
weariness_events info = do_activity( soldier_8h );
INFO( info.summarize() );
Expand All @@ -135,10 +137,10 @@ TEST_CASE( "weary_recovery", "[weary][activities]" )
INFO( info.summarize() );
INFO( guy.debug_weary_info() );
REQUIRE( !info.empty() );
CHECK( info.transition_minutes( 0, 1, 335_minutes ) == Approx( 335 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 2, 645_minutes ) == Approx( 645 ).margin( 5 ) );
CHECK( info.transition_minutes( 0, 1, 325_minutes ) == Approx( 325 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 2, 625_minutes ) == Approx( 625 ).margin( 5 ) );
CHECK( info.transition_minutes( 2, 1, 740_minutes ) == Approx( 740 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 0, 980_minutes ) == Approx( 980 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 0, 995_minutes ) == Approx( 995 ).margin( 5 ) );
}
}

Expand All @@ -153,6 +155,7 @@ TEST_CASE( "weary_24h_tasks", "[weary][activities]" )
digging_24h.enschedule( task_dig, 24_hours );

SECTION( "Waiting 24 hours" ) {
clear_avatar();
INFO( guy.debug_weary_info() );
weariness_events info = do_activity( waiting_24h );
INFO( info.summarize() );
Expand All @@ -167,14 +170,14 @@ TEST_CASE( "weary_24h_tasks", "[weary][activities]" )
INFO( info.summarize() );
INFO( guy.debug_weary_info() );
REQUIRE( !info.empty() );
CHECK( info.transition_minutes( 0, 1, 125_minutes ) == Approx( 125 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 2, 260_minutes ) == Approx( 260 ).margin( 5 ) );
CHECK( info.transition_minutes( 0, 1, 120_minutes ) == Approx( 120 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 2, 250_minutes ) == Approx( 250 ).margin( 5 ) );
CHECK( info.transition_minutes( 2, 3, 360_minutes ) == Approx( 360 ).margin( 5 ) );
CHECK( info.transition_minutes( 3, 4, 470_minutes ) == Approx( 470 ).margin( 5 ) );
CHECK( info.transition_minutes( 4, 5, 600_minutes ) == Approx( 600 ).margin( 5 ) );
CHECK( info.transition_minutes( 5, 6, 725_minutes ) == Approx( 725 ).margin( 5 ) );
CHECK( info.transition_minutes( 4, 5, 595_minutes ) == Approx( 595 ).margin( 5 ) );
CHECK( info.transition_minutes( 5, 6, 730_minutes ) == Approx( 730 ).margin( 5 ) );
CHECK( info.transition_minutes( 6, 7, 835_minutes ) == Approx( 835 ).margin( 5 ) );
CHECK( info.transition_minutes( 7, 8, 910_minutes ) == Approx( 910 ).margin( 5 ) );
CHECK( info.transition_minutes( 7, 8, 915_minutes ) == Approx( 915 ).margin( 10 ) );
// TODO: You should collapse from this - currently we
// just get really high levels of weariness
CHECK( guy.weariness_level() > 8 );
Expand Down