From 68e7b79293b83e6a8caea394885c47ab8ad31fbf Mon Sep 17 00:00:00 2001 From: actual-nh Date: Thu, 21 Jan 2021 12:21:07 -0500 Subject: [PATCH 1/5] Set stored kcal to healthy kcal for testing Randomizing test orders reveals that one type of problematic interference is due to variable stored calories from prior activity. (cherry picked from commit 306bfb4cbd817d4db60e92807025549050a576ff) --- tests/player_helpers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/player_helpers.cpp b/tests/player_helpers.cpp index b0ecdcf38d84b..9a157f73204e8 100644 --- a/tests/player_helpers.cpp +++ b/tests/player_helpers.cpp @@ -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(); + // 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(); From 16cb808b23e1bfcd23e1dffa84b5be9202a4d013 Mon Sep 17 00:00:00 2001 From: actual-nh Date: Fri, 29 Jan 2021 23:24:31 -0500 Subject: [PATCH 2/5] Match (some) weary testing to kcal resetting Previous weary testing was distored by variable incoming kcal stored, with the current default test order giving more kcal than the expected 55,000. --- tests/weary_test.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/weary_test.cpp b/tests/weary_test.cpp index 318e55a734d39..56c3313b8ead1 100644 --- a/tests/weary_test.cpp +++ b/tests/weary_test.cpp @@ -66,7 +66,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 ) ); @@ -135,8 +135,8 @@ 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 ) ); } @@ -167,14 +167,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( 4, 5, 595_minutes ) == Approx( 595 ).margin( 5 ) ); CHECK( info.transition_minutes( 5, 6, 725_minutes ) == Approx( 725 ).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, 895_minutes ) == Approx( 895 ).margin( 10 ) ); // TODO: You should collapse from this - currently we // just get really high levels of weariness CHECK( guy.weariness_level() > 8 ); From 4bf12c1c155d063598750259c1fc9ddde8fbb05c Mon Sep 17 00:00:00 2001 From: actual-nh Date: Sat, 30 Jan 2021 11:50:46 -0500 Subject: [PATCH 3/5] Update numbers to match consensus test results At least currently, two different sources (Github General build g++-7 and Appveyor) are giving the same numbers for the 24-hour digging weary test. This updates the target test numbers to match these, with a bit of wiggle room in the direction of the earlier results (partially since Travis hasn't given any results yet). --- tests/weary_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/weary_test.cpp b/tests/weary_test.cpp index 56c3313b8ead1..2655ec35d8992 100644 --- a/tests/weary_test.cpp +++ b/tests/weary_test.cpp @@ -172,9 +172,9 @@ TEST_CASE( "weary_24h_tasks", "[weary][activities]" ) 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, 595_minutes ) == Approx( 595 ).margin( 5 ) ); - CHECK( info.transition_minutes( 5, 6, 725_minutes ) == Approx( 725 ).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, 895_minutes ) == Approx( 895 ).margin( 10 ) ); + 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 ); From 1ecd7057e37e63543dced705bc1345fe5fbbc162 Mon Sep 17 00:00:00 2001 From: actual-nh Date: Sat, 30 Jan 2021 18:01:38 -0500 Subject: [PATCH 4/5] Clear_avatar before initial debug_weary_info Variable initial heights and weights is making having debug_weary_info before do_activity not useful. This adds a clear_avatar before them; unless do_activity is modified to take a flag as to whether to clear the avatar itself, this is likely temporary. --- tests/weary_test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/weary_test.cpp b/tests/weary_test.cpp index 2655ec35d8992..78177cb56cd5d 100644 --- a/tests/weary_test.cpp +++ b/tests/weary_test.cpp @@ -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() ); @@ -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() ); @@ -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() ); From 732315b78981b4551eda8e06a2c8566c4cbe280f Mon Sep 17 00:00:00 2001 From: actual-nh Date: Sat, 30 Jan 2021 21:32:05 -0500 Subject: [PATCH 5/5] Change the last target for the vehicle weary test See comments in #46941 - most specifically issuecomment-770297143. --- tests/weary_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/weary_test.cpp b/tests/weary_test.cpp index 78177cb56cd5d..be3596f6c1827 100644 --- a/tests/weary_test.cpp +++ b/tests/weary_test.cpp @@ -140,7 +140,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, 980_minutes ) == Approx( 980 ).margin( 5 ) ); + CHECK( info.transition_minutes( 1, 0, 995_minutes ) == Approx( 995 ).margin( 5 ) ); } }