diff --git a/tests/char_sight_test.cpp b/tests/char_sight_test.cpp index 62b424c551471..7a5de9fe38491 100644 --- a/tests/char_sight_test.cpp +++ b/tests/char_sight_test.cpp @@ -11,6 +11,7 @@ #include "map.h" #include "map_helpers.h" #include "options_helpers.h" +#include "overmapbuffer.h" #include "player_helpers.h" #include "type_id.h" @@ -112,7 +113,10 @@ TEST_CASE( "light_and_fine_detail_vision_mod", "[character][sight][light][vision TEST_CASE( "npc_light_and_fine_detail_vision_mod", "[character][npc][sight][light][vision]" ) { Character &u = get_player_character(); - standard_npc n( "Mr. Testerman" ); + shared_ptr_fast guy = make_shared_fast(); + overmap_buffer.insert_npc( guy ); + g->load_npcs(); + npc &n = *guy; n.set_body(); clear_avatar(); diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index e83f5c4bb6bb6..d4e542111e9c7 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -331,7 +331,9 @@ TEST_CASE( "EOC_transform_line", "[eoc][timed_event]" ) { clear_avatar(); clear_map(); - standard_npc npc( "Mr. Testerman" ); + shared_ptr_fast guy = make_shared_fast(); + overmap_buffer.insert_npc( guy ); + npc &npc = *guy; std::optional const dest = random_point( get_map(), []( tripoint const & p ) { return p.xy() != get_avatar().pos().xy(); } ); @@ -1229,7 +1231,6 @@ TEST_CASE( "EOC_combat_event_test", "[eoc]" ) clear_map(); npc &npc_dst_ranged = spawn_npc( target_pos.xy(), "thug" ); for( loop = 0; loop < 1000; loop++ ) { - get_avatar().set_body(); arm_shooter( get_avatar(), "shotgun_s" ); get_avatar().recoil = 0; get_avatar().fire_gun( target_pos, 1, *get_avatar().get_wielded_item() ); @@ -1249,7 +1250,6 @@ TEST_CASE( "EOC_combat_event_test", "[eoc]" ) clear_map(); monster &mon_dst_ranged = spawn_test_monster( "mon_zombie", target_pos ); for( loop = 0; loop < 1000; loop++ ) { - get_avatar().set_body(); arm_shooter( get_avatar(), "shotgun_s" ); get_avatar().recoil = 0; get_avatar().fire_gun( mon_dst_ranged.pos_bub(), 1, *get_avatar().get_wielded_item() ); diff --git a/tests/melee_dodge_hit_test.cpp b/tests/melee_dodge_hit_test.cpp index 8ec5bf9ec7095..a92325d146e05 100644 --- a/tests/melee_dodge_hit_test.cpp +++ b/tests/melee_dodge_hit_test.cpp @@ -220,6 +220,8 @@ TEST_CASE( "player_get_dodge", "[player][melee][dodge]" ) avatar &dummy = get_avatar(); clear_character( dummy ); + dodge_base_with_dex_and_skill( dummy, 10, 10 ); + dummy.set_dodges_left( 1 ); const float base_dodge = dummy.get_dodge_base(); @@ -241,6 +243,7 @@ TEST_CASE( "player_get_dodge_with_effects", "[player][melee][dodge][effect]" ) avatar &dummy = get_avatar(); clear_character( dummy ); + dodge_base_with_dex_and_skill( dummy, 8, 4 ); // Compare all effects against base dodge ability const float base_dodge = dummy.get_dodge_base(); @@ -263,6 +266,7 @@ TEST_CASE( "player_get_dodge_with_effects", "[player][melee][dodge][effect]" ) } SECTION( "unstable footing: 1/4 dodge" ) { + // FIXME: Margin is flat instead of relative %. CHECK( dodge_with_effect( dummy, "bouldering" ) == Approx( base_dodge / 4 ).margin( 0.1f ) ); } @@ -298,6 +302,7 @@ TEST_CASE( "player_get_dodge_stamina_effects", "[player][melee][dodge][stamina]" { avatar &dummy = get_avatar(); clear_character( dummy ); + dodge_base_with_dex_and_skill( dummy, 8, 0 ); SECTION( "8/8/8/8, no skills, unencumbered" ) { const int stamina_max = dummy.get_stamina_max(); diff --git a/tests/mongroup_test.cpp b/tests/mongroup_test.cpp index dded8c1657c6b..49e0d5d93f3c9 100644 --- a/tests/mongroup_test.cpp +++ b/tests/mongroup_test.cpp @@ -279,6 +279,9 @@ static void test_multi_spawn( const mtype_id &old_mon, int range, int min, int m { const int upgrade_attempts = 100; clear_avatar(); + // make sure tested scenarios haven't messed with our start time + calendar::start_of_cataclysm = calendar::turn_zero; + calendar::start_of_game = calendar::turn_zero; for( int i = 0; i < upgrade_attempts; i++ ) { clear_map(); diff --git a/tests/npc_talk_test.cpp b/tests/npc_talk_test.cpp index 16790e6e44028..eea6b093e2e2f 100644 --- a/tests/npc_talk_test.cpp +++ b/tests/npc_talk_test.cpp @@ -1228,6 +1228,9 @@ TEST_CASE( "npc_arithmetic", "[npc_talk]" ) d.add_topic( "TALK_TEST_ARITHMETIC" ); gen_response_lines( d, 31 ); + // make sure tested scenarios haven't messed with our start time + calendar::start_of_cataclysm = calendar::turn_zero; + calendar::start_of_game = calendar::turn_zero; calendar::turn = calendar::turn_zero; REQUIRE( calendar::turn == time_point( 0 ) ); // "Sets time since cataclysm to 1." diff --git a/tests/stomach_contents_test.cpp b/tests/stomach_contents_test.cpp index 6122477159f1e..71522fda4cf4d 100644 --- a/tests/stomach_contents_test.cpp +++ b/tests/stomach_contents_test.cpp @@ -338,6 +338,7 @@ TEST_CASE( "all_nutrition_starve_test", "[starve][slow]" ) const bool print_tests = false; avatar &dummy = get_avatar(); reset_time(); + dummy.set_stored_kcal( dummy.get_healthy_kcal() ); clear_stomach( dummy ); eat_all_nutrients( dummy ); if( print_tests ) { diff --git a/tests/vehicle_power_test.cpp b/tests/vehicle_power_test.cpp index dab37235a3ee0..16d566e38a502 100644 --- a/tests/vehicle_power_test.cpp +++ b/tests/vehicle_power_test.cpp @@ -274,6 +274,7 @@ TEST_CASE( "Daily_solar_power", "[vehicle][power]" ) TEST_CASE( "maximum_reverse_velocity", "[vehicle][power][reverse]" ) { + clear_map(); reset_player(); build_test_map( ter_id( "t_pavement" ) ); clear_vehicles(); diff --git a/tests/vehicle_split_test.cpp b/tests/vehicle_split_test.cpp index 160d4d3f0c649..b75d5aeec0c0b 100644 --- a/tests/vehicle_split_test.cpp +++ b/tests/vehicle_split_test.cpp @@ -16,6 +16,8 @@ static const vproto_id vehicle_prototype_cross_split_test( "cross_split_test" ); TEST_CASE( "vehicle_split_section", "[vehicle]" ) { + wipe_map_terrain(); + clear_vehicles(); map &here = get_map(); Character &player_character = get_player_character(); for( units::angle dir = 0_degrees; dir < 360_degrees; dir += vehicles::steer_increment ) {