Skip to content

Commit

Permalink
Merge pull request #77989 from ShnitzelX2/fix-ranged-balance-test
Browse files Browse the repository at this point in the history
Better margin of error for test shot_custom_damage_type
  • Loading branch information
Maleclypse authored Nov 21, 2024
2 parents c5b5049 + d6c602c commit 419df31
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/ranged_balance_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,7 @@ TEST_CASE( "synthetic_range_test", "[.]" )
static void shoot_monster( const std::string &gun_type, const std::vector<std::string> &mods,
const std::string &ammo_type, int range,
int expected_damage, const std::string &monster_type,
const std::function<bool ( const standard_npc &, const monster & )> &other_checks = nullptr,
const Approx &expected_other_checks = Approx( 0 ) )
const std::function<bool ( const standard_npc &, const monster & )> &other_checks = nullptr )
{
clear_map();
statistics<int> damage;
Expand Down Expand Up @@ -479,7 +478,7 @@ static void shoot_monster( const std::string &gun_type, const std::vector<std::s
CAPTURE( avg );
CHECK( avg == Approx( expected_damage ).margin( 20 ) );
if( other_checks ) {
CHECK( other_check_success == expected_other_checks );
CHECK( other_check_success == Approx( damage.n() ).margin( 10 ) );
}
}

Expand Down Expand Up @@ -589,14 +588,15 @@ TEST_CASE( "shot_custom_damage_type", "[gun]" "[slow]" )
tgt.get_value( "general_dmg_type_test_test_fire" ) == "target";
};
// Check that ballistics damage processes weird damage types and on-hit EOCs
// note: shotguns can miss one-shot critical hit rarely
shoot_monster( "shotgun_s", {}, "test_shot_00_fire_damage", 1, 80,
"mon_test_zombie", check_eocs, Approx( 200 ).margin( 100 ) );
"mon_test_zombie", check_eocs );
shoot_monster( "shotgun_s", {}, "test_shot_00_fire_damage", 1, 80,
"mon_test_fire_resist", check_eocs, Approx( 200 ).margin( 100 ) );
"mon_test_fire_resist", check_eocs );
shoot_monster( "shotgun_s", {}, "test_shot_00_fire_damage", 1, 18,
"mon_test_fire_vresist", check_eocs, Approx( 200 ).margin( 100 ) );
"mon_test_fire_vresist", check_eocs );
shoot_monster( "shotgun_s", {}, "test_shot_00_fire_damage", 1, 0,
"mon_test_fire_immune", check_eocs, Approx( 200 ).margin( 100 ) );
"mon_test_fire_immune", check_eocs );
}

// Targeting graph tests
Expand Down

0 comments on commit 419df31

Please sign in to comment.