Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IWYU for tests #42806

Merged
merged 2 commits into from
Aug 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coordinates.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "coordinate_conversions.h"
#include "enums.h"
#include "game_constants.h"
#include "line.h"
#include "point.h"
#include "debug.h"

Expand Down
2 changes: 0 additions & 2 deletions tests/active_item_cache_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "catch/catch.hpp"

#include <memory>
#include <set>

#include "calendar.h"
#include "game_constants.h"
#include "item.h"
#include "map.h"
Expand Down
4 changes: 3 additions & 1 deletion tests/active_item_test.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "catch/catch.hpp"

#include <list>

#include "avatar.h"
#include "item.h"
#include "map.h"
#include "map_helpers.h"
#include "optional.h"
#include "player_helpers.h"
#include "point.h"

TEST_CASE( "active_items_processed_regularly", "[item]" )
{
Expand Down
4 changes: 3 additions & 1 deletion tests/ammo_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "catch/catch.hpp"

#include <set>

#include "item.h"
#include "itype.h"
#include "type_id.h"

// Functions:
// - item::ammo_types
Expand Down
3 changes: 2 additions & 1 deletion tests/archery_damage_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include "catch/catch.hpp"

#include <memory>
#include <set>
#include <string>

#include "damage.h"
#include "game_constants.h"
#include "int_id.h"
#include "item.h"
#include "itype.h"
#include "map.h"
Expand All @@ -27,6 +27,7 @@
#include "point.h"
#include "projectile.h"
#include "type_id.h"
#include "value_ptr.h"

// In short, a bow should never destroy a wall, pretty simple.
static void test_projectile_hitting_wall( const std::string &target_type, bool smashable,
Expand Down
12 changes: 12 additions & 0 deletions tests/battery_mod_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
#include "catch/catch.hpp"

#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>

#include "flat_set.h"
#include "item.h"
#include "item_contents.h"
#include "item_pocket.h"
#include "itype.h"
#include "ret_val.h"
#include "type_id.h"
#include "value_ptr.h"

// Includes functions:
// item::magazine_compatible
Expand Down
14 changes: 8 additions & 6 deletions tests/behavior_test.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
#include "catch/catch.hpp"
#include "behavior.h"

#include <memory>
#include <list>
#include <string>
#include <vector>

#include "behavior.h"
#include "behavior_oracle.h"
#include "behavior_strategy.h"
#include "character_oracle.h"
#include "item.h"
#include "item_location.h"
#include "map.h"
#include "map_helpers.h"
#include "map_iterator.h"
#include "monster.h"
#include "monster_oracle.h"
#include "mtype.h"
#include "npc.h"
#include "player.h"
#include "map_helpers.h"
#include "player_helpers.h"
#include "string_id.h"
#include "point.h"
#include "type_id.h"
#include "weather.h"

namespace behavior
{
class oracle_t;

extern sequential_t default_sequential;
extern fallback_t default_fallback;
extern sequential_until_done_t default_until_done;
Expand Down
5 changes: 3 additions & 2 deletions tests/bionics_test.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#include "catch/catch.hpp"
#include "bionics.h"

#include <climits>
#include <list>
#include <memory>
#include <string>

#include "avatar.h"
#include "bionics.h"
#include "calendar.h"
#include "item.h"
#include "item_pocket.h"
#include "pimpl.h"
#include "player.h"
#include "player_helpers.h"
#include "ret_val.h"
#include "type_id.h"
#include "units.h"

Expand Down
4 changes: 2 additions & 2 deletions tests/calendar_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "catch/catch.hpp"

#include "calendar.h"
#include "options_helpers.h"

#include <string>

TEST_CASE( "time_duration_to_string", "[calendar]" )
{
Expand Down
3 changes: 3 additions & 0 deletions tests/cata_generators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "cata_generators.h"

#include <memory>
#include <random>

#include "point.h"
#include "rng.h"

Expand Down
5 changes: 2 additions & 3 deletions tests/cata_variant_test.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#include "catch/catch.hpp"
#include "cata_variant.h"

#include <sstream>
#include <string>
#include <utility>

#include "cata_variant.h"
#include "character_id.h"
#include "enum_conversions.h"
#include "item.h"
#include "json.h"
#include "string_id.h"
#include "point.h"
#include "type_id.h"

TEST_CASE( "variant_construction", "[variant]" )
Expand Down
5 changes: 4 additions & 1 deletion tests/catacharset_test.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#include "catch/catch.hpp"
#include "catacharset.h"

#include <clocale>
#include <locale>
#include <stdexcept>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#include "catacharset.h"
#include "translations.h"

TEST_CASE( "utf8_width", "[catacharset]" )
Expand Down
3 changes: 2 additions & 1 deletion tests/char_healing_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#include <string>

#include "avatar.h"
#include "effect.h"
#include "calendar.h"
#include "character.h"
#include "options.h"
#include "player.h"
#include "type_id.h"
Expand Down
3 changes: 0 additions & 3 deletions tests/char_stamina_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include "catch/catch.hpp"

#include <memory>

#include "bodypart.h"
#include "calendar.h"
#include "character.h"
#include "item.h"
Expand Down
1 change: 0 additions & 1 deletion tests/comestible_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "recipe_dictionary.h"
#include "requirements.h"
#include "stomach.h"
#include "string_id.h"
#include "test_statistics.h"
#include "type_id.h"
#include "value_ptr.h"
Expand Down
9 changes: 6 additions & 3 deletions tests/coordinate_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include "catch/catch.hpp"

#include "coordinates.h"
#include "coordinate_conversions.h"
#include <string>
#include <tuple>

#include "cata_generators.h"
#include "stringmaker.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few places where you've removed stringmaker.h. This specializes some templates to customize Catch2 output and should remain. I don't think there's any way for IWYU to know this so I guess it will have to get a pragma everywhere we include it.

Don't know whether you want to go to the trouble of reverting this now, but it's something to bear in mind for the future if you run IWYU again or see {?} printed out in test results.

#include "coordinate_conversions.h"
#include "coordinates.h"
#include "point.h"

constexpr int num_trials = 5;

Expand Down
5 changes: 4 additions & 1 deletion tests/crafting_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <algorithm>
#include <climits>
#include <list>
#include <map>
#include <memory>
#include <set>
Expand All @@ -13,8 +14,10 @@
#include "avatar.h"
#include "calendar.h"
#include "cata_utility.h"
#include "character.h"
#include "game.h"
#include "item.h"
#include "item_pocket.h"
#include "itype.h"
#include "map.h"
#include "map_helpers.h"
Expand All @@ -25,7 +28,7 @@
#include "recipe.h"
#include "recipe_dictionary.h"
#include "requirements.h"
#include "string_id.h"
#include "ret_val.h"
#include "type_id.h"
#include "value_ptr.h"

Expand Down
6 changes: 5 additions & 1 deletion tests/creature_effect_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include "catch/catch.hpp"

#include <string>

#include "avatar.h"
#include "creature.h"
#include "calendar.h"
#include "monster.h"
#include "mtype.h"
#include "type_id.h"

// Test effect methods from `Creature` class on both `monster` and `player`

Expand Down
2 changes: 0 additions & 2 deletions tests/creature_in_field_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "catch/catch.hpp"

#include <memory>

#include "map.h"
#include "map_helpers.h"
#include "monster.h"
Expand Down
7 changes: 6 additions & 1 deletion tests/effect_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include "catch/catch.hpp"

#include "effect.h"

#include <string>
#include <vector>

#include "calendar.h"
#include "type_id.h"

// Test `effect` class

// Effect initialization
Expand Down
12 changes: 6 additions & 6 deletions tests/effective_dps_test.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "catch/catch.hpp"

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <string>

#include "avatar.h"
#include "calendar.h"
#include "creature.h"
#include "item.h"
#include "melee.h"
#include "monster.h"
#include "player.h"
#include "type_id.h"

#include "player_helpers.h"
#include "ret_val.h"
#include "type_id.h"

// Run a large number of trials of a player attacking a monster with a given weapon,
// and return the average damage done per second.
Expand Down
4 changes: 0 additions & 4 deletions tests/encumbrance_test.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#include "catch/catch.hpp"

#include <array>
#include <functional>
#include <list>
#include <memory>
#include <string>
#include <vector>

#include "bodypart.h"
#include "character.h"
#include "debug.h"
#include "item.h"
#include "material.h"
#include "npc.h"
#include "type_id.h"

Expand Down
5 changes: 1 addition & 4 deletions tests/event_test.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#include "catch/catch.hpp"
#include "event.h"

#include <algorithm>
#include <string>
#include <vector>

#include "calendar.h"
#include "cata_variant.h"
#include "character_id.h"
#include "event.h"
#include "event_bus.h"
#include "event_subscriber.h"
#include "string_id.h"
#include "type_id.h"

TEST_CASE( "construct_event", "[event]" )
Expand Down
2 changes: 0 additions & 2 deletions tests/explosion_balance_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "catch/catch.hpp"

#include <algorithm>
#include <cstddef>
#include <memory>
#include <sstream>
Expand All @@ -16,7 +15,6 @@
#include "map.h"
#include "map_helpers.h"
#include "point.h"
#include "string_id.h"
#include "test_statistics.h"
#include "type_id.h"
#include "veh_type.h"
Expand Down
4 changes: 3 additions & 1 deletion tests/fake_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
#include <utility>
#include <vector>

#include "messages.h"
#include "enums.h"
#include "messages.h"

class Creature;
class JsonObject;
class JsonOut;
struct tripoint;

namespace catacurses
{
Expand Down
Loading