Skip to content

Commit

Permalink
Adjust tests for smoother weary.tracker
Browse files Browse the repository at this point in the history
Some of the test times were being altered by the every-30-minute
(awake) weary.tracker reductions. Alter to match new ones, also taking
into account local testing (including in scrambled order). While with
some scrambled tests am seeing inconsistencies between 8-hour and
12-hour digging, 8-hour without fluctuations indicated 3->4 should not
be 470 minutes, but no more than 465 - which it already was for
12-hour, weirdly enough (oops by me earlier?).
  • Loading branch information
actual-nh committed Feb 20, 2021
1 parent 5d9dcb2 commit c68507b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5708,7 +5708,7 @@ void Character::try_reduce_weariness( const float exertion )

const float recovery_mult = get_option<float>( "WEARY_RECOVERY_MULT" );

if( weary.low_activity_ticks > 0 ) {
if( weary.low_activity_ticks >= 1 ) {
int reduction = weary.tracker;
const int bmr = base_bmr();
// 1/120 of whichever's bigger
Expand Down
8 changes: 4 additions & 4 deletions tests/weary_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEST_CASE( "weary_assorted_tasks", "[weary][activities][!mayfail]" )
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 ) );
CHECK( info.transition_minutes( 3, 4, 465_minutes ) == Approx( 465 ).margin( 5 ) );
CHECK( !info.have_weary_decrease() );
CHECK( guy.weariness_level() == 4 );
}
Expand Down Expand Up @@ -132,8 +132,8 @@ TEST_CASE( "weary_recovery", "[weary][activities]" )
INFO( info.summarize() );
INFO( guy.debug_weary_info() );
REQUIRE( !info.empty() );
CHECK( info.transition_minutes( 4, 3, 520_minutes ) == Approx( 520 ).margin( 5 ) );
CHECK( info.transition_minutes( 3, 2, 640_minutes ) == Approx( 640 ).margin( 5 ) );
CHECK( info.transition_minutes( 4, 3, 505_minutes ) == Approx( 505 ).margin( 5 ) );
CHECK( info.transition_minutes( 3, 2, 630_minutes ) == Approx( 630 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 0, 0_minutes ) > ( 8 * 60 ) ); // should be INT_MAX
CHECK( info.transition_minutes( 2, 1, 0_minutes ) > ( 8 * 60 ) );
CHECK( info.transition_minutes( 1, 2, 16_hours ) <= ( 8 * 60 ) );
Expand All @@ -153,7 +153,7 @@ TEST_CASE( "weary_recovery", "[weary][activities]" )
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, 995_minutes ) == Approx( 995 ).margin( 5 ) );
CHECK( info.transition_minutes( 1, 0, 985_minutes ) == Approx( 985 ).margin( 5 ) );
}
}

Expand Down

0 comments on commit c68507b

Please sign in to comment.