tests/: wrap TU-local test fixture types in anon namespaces
- addiction_test: wrap addict_effect_totals - battery_density_test: wrap battery_chemistry_family - comestible_test: wrap all_stats - encumbrance_test: wrap add_trait - invlet_test: fuse inventory_location + invlet_state + test_action enums - throwing_test: fuse throw_test_data + throw_test_pstats, move operator<< inside anon-ns - vehicle_test: wrap vehicle_preset, damage_preset, folded_item_damage_preset, fuse rack_activation + rack_preset - vision_test: wrap vision_test_case - water_movement_test: fuse 6 swimmer/swim structs into one block - weakpoint_test: wrap weakpoint_test_data, weakpoint_expectation, weakpoint_report
This commit is contained in:
@@ -36,6 +36,8 @@ static const trait_id trait_MUT_JUNKIE( "MUT_JUNKIE" );
|
||||
|
||||
static constexpr int max_iters = 100000;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct addict_effect_totals {
|
||||
int sleepiness = 0;
|
||||
int morale = 0;
|
||||
@@ -67,6 +69,7 @@ struct addict_effect_totals {
|
||||
hallu += u.has_effect( effect_hallu ) ? 1 : 0;
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static void clear_addictions( Character &u )
|
||||
{
|
||||
|
||||
@@ -17,10 +17,13 @@
|
||||
static const ammotype ammo_battery( "battery" );
|
||||
static const flag_id json_flag_DEBUG_ONLY( "DEBUG_ONLY" );
|
||||
|
||||
namespace
|
||||
{
|
||||
struct battery_chemistry_family {
|
||||
float max_energy_density_kj_kg;
|
||||
float max_energy_density_kj_l;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
// NOLINTBEGIN(cata-static-string_id-constants)
|
||||
static const std::map<itype_id, std::string> battery_to_chemistry = {
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "point.h"
|
||||
#include "rng.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class RandomPointGenerator final :
|
||||
public Catch::Generators::IGenerator<point>
|
||||
{
|
||||
@@ -56,6 +59,8 @@ class RandomTripointGenerator final :
|
||||
tripoint current_point;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Catch::Generators::GeneratorWrapper<point> random_points( int low, int high )
|
||||
{
|
||||
return Catch::Generators::GeneratorWrapper<point>(
|
||||
|
||||
@@ -76,9 +76,12 @@ static const std::vector<vitamin_id> mutagen_vit_list{ vitamin_mutagen, vitamin_
|
||||
|
||||
static const std::vector<itype_id> marloss_food{ itype_marloss_berry, itype_marloss_gel, itype_marloss_seed };
|
||||
|
||||
namespace
|
||||
{
|
||||
struct all_stats {
|
||||
statistics<int> calories;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
// given a list of components, adds all the calories together
|
||||
static int comp_calories( const std::vector<item_comp> &components )
|
||||
|
||||
@@ -61,6 +61,9 @@ static void advance_turn( Character &guy )
|
||||
calendar::turn += 1_turns;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct enchant_test {
|
||||
int dex_before;
|
||||
int lie_before;
|
||||
@@ -68,6 +71,8 @@ struct enchant_test {
|
||||
int intimidate_before;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static void test_generic_ench( avatar &p, enchant_test enc_test )
|
||||
{
|
||||
// wait a turn for the effect to kick in
|
||||
|
||||
@@ -83,6 +83,8 @@ static void test_encumbrance(
|
||||
test_encumbrance_items( clothing, body_part, expected_encumbrance );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct add_trait {
|
||||
explicit add_trait( const std::string &t ) : trait( t ) {}
|
||||
explicit add_trait( const trait_id &t ) : trait( t ) {}
|
||||
@@ -93,6 +95,7 @@ struct add_trait {
|
||||
|
||||
trait_id trait;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static constexpr int postman_shirt_e = 0;
|
||||
static constexpr int longshirt_e = 3;
|
||||
|
||||
@@ -26,6 +26,9 @@ TEST_CASE( "construct_event", "[event]" )
|
||||
CHECK( e.get<int>( "exp" ) == 100 );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct test_subscriber : public event_subscriber {
|
||||
using event_subscriber::notify;
|
||||
void notify( const cata::event &e ) override {
|
||||
@@ -35,6 +38,8 @@ struct test_subscriber : public event_subscriber {
|
||||
std::vector<cata::event> events;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "push_event_on_vector", "[event]" )
|
||||
{
|
||||
std::vector<cata::event> test_events;
|
||||
@@ -80,6 +85,9 @@ TEST_CASE( "destroy_bus_before_subscriber", "[event]" )
|
||||
CHECK( sub.events.size() == 1 );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct expect_subscriber : public event_subscriber {
|
||||
using event_subscriber::notify;
|
||||
void notify( const cata::event & ) override {
|
||||
@@ -88,6 +96,8 @@ struct expect_subscriber : public event_subscriber {
|
||||
bool found = false;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "notify_subscriber_2", "[event]" )
|
||||
{
|
||||
cata::event original_event = cata::event::make<event_type::character_kills_monster>(
|
||||
|
||||
@@ -41,10 +41,15 @@ static const damage_type_id damage_bullet( "bullet" );
|
||||
|
||||
static const itype_id itype_grenade_act( "grenade_act" );
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
enum class outcome_type {
|
||||
Kill, Casualty
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static float get_damage_vs_target( const std::string &target_id )
|
||||
{
|
||||
projectile proj;
|
||||
|
||||
@@ -110,6 +110,7 @@ TEST_CASE( "flat_set_comparison", "[flat_set]" )
|
||||
CHECK( int_set{ 6, 0 } < int_set{ 1 } );
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage): anon-ns wrap makes friend-operator overloads look unused
|
||||
struct int_like {
|
||||
int i;
|
||||
#define INT_LIKE_OPERATOR( op ) \
|
||||
|
||||
@@ -33,6 +33,8 @@ static const itype_id itype_backpack( "backpack" );
|
||||
static const itype_id itype_jeans( "jeans" );
|
||||
static const itype_id itype_tshirt( "tshirt" );
|
||||
|
||||
namespace
|
||||
{
|
||||
enum inventory_location {
|
||||
GROUND,
|
||||
INVENTORY,
|
||||
@@ -55,6 +57,7 @@ enum test_action {
|
||||
REMOVE_1ST_ADD_1ST,
|
||||
TEST_ACTION_NUM,
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static void set_id( item &it, const std::string &id )
|
||||
{
|
||||
|
||||
@@ -60,6 +60,9 @@ static const itype_id itype_wrapper( "wrapper" );
|
||||
|
||||
static const pocket_type pocket_type_container = pocket_type::CONTAINER;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class unique_item
|
||||
{
|
||||
private:
|
||||
@@ -141,6 +144,8 @@ class unique_item
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Add the given item to auto-pickup character rules and check rules.
|
||||
static void add_autopickup_rule( const item *what, bool include )
|
||||
{
|
||||
|
||||
@@ -77,6 +77,9 @@ static const ter_str_id ter_t_wall_wood( "t_wall_wood" );
|
||||
static const ter_str_id ter_t_water_dp( "t_water_dp" );
|
||||
static const ter_str_id ter_t_wood_stairs_up( "t_wood_stairs_up" );
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// Scan a 24x24 OMT area on a map and collect terrain/field statistics.
|
||||
struct pp_scan_result {
|
||||
int wall_wood_count = 0;
|
||||
@@ -90,6 +93,8 @@ struct pp_scan_result {
|
||||
int furniture_count = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static pp_scan_result scan_omt( map &m, int z_level )
|
||||
{
|
||||
pp_scan_result result;
|
||||
@@ -190,6 +195,9 @@ TEST_CASE( "post_process_riot_damage_seeded_smoke", "[mapgen][post_process]" )
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// Capture full tile-by-tile snapshot of a 24x24 OMT for exact comparison.
|
||||
struct tile_state {
|
||||
ter_id ter;
|
||||
@@ -198,6 +206,8 @@ struct tile_state {
|
||||
int fire_intensity;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static std::vector<tile_state> snapshot_omt( map &m, int z_level )
|
||||
{
|
||||
std::vector<tile_state> snap;
|
||||
|
||||
@@ -98,6 +98,9 @@ static int moves_to_destination( const std::string &monster_type,
|
||||
return 100000;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct track {
|
||||
char participant;
|
||||
int moves;
|
||||
@@ -105,7 +108,7 @@ struct track {
|
||||
tripoint location;
|
||||
};
|
||||
|
||||
static std::ostream &operator<<( std::ostream &os, track const &value )
|
||||
std::ostream &operator<<( std::ostream &os, track const &value )
|
||||
{
|
||||
os << value.participant <<
|
||||
" l:" << value.location <<
|
||||
@@ -114,7 +117,7 @@ static std::ostream &operator<<( std::ostream &os, track const &value )
|
||||
return os;
|
||||
}
|
||||
|
||||
static std::ostream &operator<<( std::ostream &os, const std::vector<track> &vec )
|
||||
std::ostream &operator<<( std::ostream &os, const std::vector<track> &vec )
|
||||
{
|
||||
for( const track &track_instance : vec ) {
|
||||
os << track_instance << " ";
|
||||
@@ -122,6 +125,8 @@ static std::ostream &operator<<( std::ostream &os, const std::vector<track> &vec
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
/**
|
||||
* Simulate a player running from the monster, checking if it can catch up.
|
||||
**/
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "path_info.h"
|
||||
#include "text_snippets.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class IsOneOf : public Catch::MatcherBase<std::string>
|
||||
{
|
||||
std::set< std::string > values;
|
||||
@@ -24,6 +27,8 @@ class IsOneOf : public Catch::MatcherBase<std::string>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "name_generation", "[name]" )
|
||||
{
|
||||
GIVEN( "Names loaded from tests/data/name.json" ) {
|
||||
|
||||
@@ -85,6 +85,9 @@ static int get_item_count( const std::set<const item *> &items )
|
||||
return sum;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct failure {
|
||||
string_id<profession> prof;
|
||||
std::vector<trait_id> mut;
|
||||
@@ -92,6 +95,8 @@ struct failure {
|
||||
std::string reason;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
|
||||
@@ -92,6 +92,9 @@ static const itype_id itype_test_shot_00_fire_damage( "test_shot_00_fire_damage"
|
||||
|
||||
using firing_statistics = statistics<bool>;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class Threshold
|
||||
{
|
||||
public:
|
||||
@@ -109,6 +112,8 @@ class Threshold
|
||||
double _chance;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
template < class T >
|
||||
static std::ostream &operator <<( std::ostream &os, const std::vector<T> &v )
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
#include "safe_reference.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct example {
|
||||
safe_reference_anchor anchor;
|
||||
|
||||
@@ -12,6 +15,8 @@ struct example {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "safe_reference_returns_correct_object", "[safe_reference]" )
|
||||
{
|
||||
example e;
|
||||
|
||||
@@ -514,6 +514,9 @@ static constexpr float X = LIGHT_TRANSPARENCY_SOLID;
|
||||
|
||||
static const tripoint_bub_ms ORIGIN( 65, 65, 11 );
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct grid_overlay {
|
||||
std::vector<std::vector<std::vector<float>>> data;
|
||||
std::vector<std::vector<std::vector<bool>>> floor;
|
||||
@@ -569,6 +572,8 @@ struct grid_overlay {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static void run_spot_check( const grid_overlay &test_case, const grid_overlay &expected,
|
||||
bool fov_3d )
|
||||
{
|
||||
|
||||
@@ -404,6 +404,9 @@ TEST_CASE( "stats_tracker_with_event_statistics", "[stats]" )
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct watch_stat : stat_watcher {
|
||||
void new_value( const cata_variant &v, stats_tracker & ) override {
|
||||
value = v;
|
||||
@@ -411,6 +414,8 @@ struct watch_stat : stat_watcher {
|
||||
cata_variant value;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "stats_tracker_watchers", "[stats]" )
|
||||
{
|
||||
stats_tracker s;
|
||||
@@ -916,6 +921,9 @@ TEST_CASE( "stats_tracker_in_game", "[stats]" )
|
||||
CHECK( get_stats().get_events( e.type() ).count( e.data() ) == 1 );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct stats_test_subscriber : public event_subscriber {
|
||||
using event_subscriber::notify;
|
||||
void notify( const cata::event &e ) override {
|
||||
@@ -928,6 +936,8 @@ struct stats_test_subscriber : public event_subscriber {
|
||||
std::vector<cata::event> events;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE( "achievements_tracker_in_game", "[stats]" )
|
||||
{
|
||||
get_stats().clear();
|
||||
|
||||
@@ -887,6 +887,9 @@ static void load_from_jsin( submap &sm, const JsonValue &jsin )
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct submap_checks {
|
||||
bool terrain = true;
|
||||
bool furniture = true;
|
||||
@@ -901,6 +904,8 @@ struct submap_checks {
|
||||
bool computers = true;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
//static const submap_checks dont_care;
|
||||
|
||||
static bool is_normal_submap( const submap &sm, submap_checks checks = {} )
|
||||
|
||||
@@ -203,6 +203,9 @@ static option_overrides_t extract_option_overrides( const std::string_view optio
|
||||
return ret;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct CataListener : Catch::TestEventListenerBase {
|
||||
using TestEventListenerBase::TestEventListenerBase;
|
||||
|
||||
@@ -308,6 +311,8 @@ struct CataListener : Catch::TestEventListenerBase {
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CATCH_REGISTER_LISTENER( CataListener )
|
||||
|
||||
// NOLINTNEXTLINE(cata-test-filename)
|
||||
|
||||
@@ -39,6 +39,8 @@ TEST_CASE( "throwing_distance_test", "[throwing], [balance]" )
|
||||
CHECK( thrower.throw_range( grenade ) <= 35 );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct throw_test_data {
|
||||
statistics<bool> hits;
|
||||
statistics<double> dmg;
|
||||
@@ -53,11 +55,12 @@ struct throw_test_pstats {
|
||||
int per;
|
||||
};
|
||||
|
||||
static std::ostream &operator<<( std::ostream &stream, const throw_test_pstats &pstats )
|
||||
std::ostream &operator<<( std::ostream &stream, const throw_test_pstats &pstats )
|
||||
{
|
||||
return stream << "STR: " << pstats.str << " DEX: " << pstats.dex <<
|
||||
" PER: " << pstats.per << " SKL: " << pstats.skill_lvl;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static void reset_player( Character &you, const throw_test_pstats &pstats,
|
||||
const tripoint_bub_ms &pos )
|
||||
|
||||
@@ -167,11 +167,16 @@ TEST_CASE( "starting_bicycle_damaged_pedal", "[vehicle]" )
|
||||
here.detach_vehicle( veh_ptr );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct vehicle_preset {
|
||||
itype_id vehicle_itype_id; // folding vehicle to test
|
||||
std::vector<itype_id> tool_itype_ids; // tool to grant
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
struct damage_preset {
|
||||
int damage;
|
||||
int degradation;
|
||||
@@ -179,6 +184,7 @@ struct damage_preset {
|
||||
int expect_degradation;
|
||||
int expect_hp;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static void complete_activity( Character &u, const activity_actor &act )
|
||||
{
|
||||
@@ -332,6 +338,8 @@ TEST_CASE( "Unfolding_vehicle_parts_and_testing_degradation", "[item][degradatio
|
||||
clear_vehicles( &get_map() );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct folded_item_damage_preset {
|
||||
itype_id folded_vehicle_item;
|
||||
int item_damage_first_fold;
|
||||
@@ -339,6 +347,7 @@ struct folded_item_damage_preset {
|
||||
int part_damage_second_unfold; // sum of damage over all parts
|
||||
int part_damage_third_unfold; // sum of damage over all parts
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static void check_folded_item_to_parts_damage_transfer( const folded_item_damage_preset &preset )
|
||||
{
|
||||
@@ -583,6 +592,8 @@ TEST_CASE( "power_cable_stretch_disconnect" )
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct rack_activation {
|
||||
int racking_vehicle_index; // vehicle with the rack
|
||||
tripoint_bub_ms rack_pos; // rack to activate
|
||||
@@ -601,6 +612,7 @@ struct rack_preset {
|
||||
std::vector<rack_activation> rack_orders; // racking orders
|
||||
std::vector<rack_activation> unrack_orders; // unracking orders
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static void rack_check( const rack_preset &preset )
|
||||
{
|
||||
|
||||
@@ -131,6 +131,8 @@ static const tile_predicate set_up_tiles_common =
|
||||
ifchar( 'G', ter_set( ter_t_window_stained_green ) + ter_set_flat_roof_above ) ||
|
||||
fail;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct vision_test_flags {
|
||||
bool crouching = false;
|
||||
bool headlamp = false;
|
||||
@@ -138,7 +140,10 @@ struct vision_test_flags {
|
||||
bool moncam = false;
|
||||
bool myopic = false;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
struct vision_test_case {
|
||||
|
||||
std::vector<std::string> setup;
|
||||
@@ -240,6 +245,7 @@ struct vision_test_case {
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static std::optional<units::angle> testcase_veh_dir( point const &def, vision_test_case const &t,
|
||||
map_test_case::tile &tile )
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
static const tripoint_bub_ms p1( 0, 0, -2 );
|
||||
static const tripoint_bub_ms p2( ( MAPSIZE *SEEX ) - 1, ( MAPSIZE *SEEY ) - 1, 1 );
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct structure {
|
||||
structure( const tripoint_bub_ms &origin, const tripoint_rel_ms &dimensions,
|
||||
const std::string &name ) :
|
||||
@@ -32,6 +35,8 @@ struct structure {
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static void place_structures( const std::vector<structure> &spawn_areas,
|
||||
std::vector<std::vector<tripoint_bub_ms>> &interior_areas,
|
||||
std::vector<tripoint_bub_ms> &outside_area,
|
||||
|
||||
@@ -173,6 +173,8 @@ TEST_CASE( "avatar_diving", "[diving]" )
|
||||
g->vertical_shift( 0 );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct swimmer_stats {
|
||||
int strength = 0;
|
||||
int dexterity = 0;
|
||||
@@ -230,6 +232,7 @@ struct swim_result {
|
||||
int move_cost = 0;
|
||||
int steps = 0;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static const std::unordered_map<std::string, swimmer_stats> stats_map = {
|
||||
{"minimum", { 4, 4 }},
|
||||
@@ -257,6 +260,8 @@ static const std::unordered_map<std::string, swimmer_traits> traits_map = {
|
||||
{"webbed hands and feet", {{"WEBBED", "WEBBED_FEET"}}},
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
struct swim_scenario {
|
||||
move_mode_id move_mode;
|
||||
swimmer_config config;
|
||||
@@ -275,6 +280,7 @@ struct swim_scenario {
|
||||
config.stats_name, config.skills_name, config.gear_name, config.traits_name );
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static int swimming_steps( avatar &swimmer )
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ static const mtype_id mon_test_zombie_cop( "mon_test_zombie_cop" );
|
||||
static const mtype_id mon_zombie( "mon_zombie" );
|
||||
static const mtype_id pseudo_debug_mon( "pseudo_debug_mon" );
|
||||
|
||||
namespace
|
||||
{
|
||||
struct weakpoint_report_item {
|
||||
std::string weakpoint;
|
||||
int totaldamage;
|
||||
@@ -43,7 +45,10 @@ struct weakpoint_report_item {
|
||||
hits{ 1 } { }
|
||||
weakpoint_report_item() : weakpoint_report_item( "", 0 ) { }
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
struct weakpoint_report {
|
||||
int hits;
|
||||
std::map<std::string, weakpoint_report_item> items;
|
||||
@@ -79,6 +84,7 @@ struct weakpoint_report {
|
||||
items.clear();
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static weakpoint_report damage_monster( const mtype_id &target_type, const damage_instance &dam,
|
||||
int attacks )
|
||||
@@ -281,12 +287,15 @@ TEST_CASE( "Check_copy-from_inheritance_between_sets_and_inline_weakpoints",
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct wp_test_values {
|
||||
mtype_id mon;
|
||||
itype_id weapon;
|
||||
float skill_lvl;
|
||||
float accuracy = 0.f;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static std::unordered_map<std::string, int> weakpoint_hit_distribution_proj(
|
||||
wp_test_values test_values )
|
||||
|
||||
@@ -50,6 +50,9 @@ static double proportion_gteq_x( std::vector<double> const &v, double x )
|
||||
static constexpr int n_hours = to_hours<int>( 1_days );
|
||||
static constexpr int n_minutes = to_minutes<int>( 1_days );
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct year_of_weather_data {
|
||||
explicit year_of_weather_data( int n_days )
|
||||
: temperature( n_days, std::vector<double>( n_minutes, 0 ) )
|
||||
@@ -64,6 +67,8 @@ struct year_of_weather_data {
|
||||
std::vector<double> lows;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static year_of_weather_data collect_weather_data( unsigned seed )
|
||||
{
|
||||
scoped_weather_override null_weather( WEATHER_NULL );
|
||||
|
||||
Reference in New Issue
Block a user