From d595bcf56e057443bbba0d42d9bc4460ab91356f Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 6 Feb 2022 16:32:09 +0000 Subject: [PATCH] Run clang-format on whole repository Using: shopt -s globstar /mnt/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2019/Community/VC/Tools/Llvm/bin/clang-format.exe -i include/**/*.h src/**/*.h src/**/*.cpp --- include/loot/api.h | 25 ++++-- include/loot/database_interface.h | 7 +- include/loot/metadata/filename.h | 35 ++++---- include/loot/metadata/group.h | 4 +- include/loot/metadata/location.h | 15 ++-- include/loot/metadata/message.h | 14 +-- include/loot/metadata/message_content.h | 7 +- include/loot/metadata/plugin_cleaning_data.h | 16 ++-- include/loot/metadata/tag.h | 8 +- src/api/game/game.h | 4 +- src/api/game/load_order_handler.h | 5 +- src/api/helpers/crc.cpp | 4 +- src/api/helpers/logging.h | 2 +- src/api/metadata/condition_evaluator.cpp | 90 ++++++++++--------- src/api/metadata/condition_evaluator.h | 11 +-- src/api/metadata/file.cpp | 3 +- src/api/metadata/filename.cpp | 15 ++-- src/api/metadata/group.cpp | 12 +-- src/api/metadata/location.cpp | 3 +- src/api/metadata/message.cpp | 6 +- src/api/metadata/message_content.cpp | 5 +- src/api/metadata/plugin_cleaning_data.cpp | 24 +++-- src/api/metadata/tag.cpp | 4 +- src/api/metadata/yaml/group.h | 4 +- src/api/metadata/yaml/location.h | 4 +- src/api/metadata/yaml/message.h | 6 +- src/api/metadata/yaml/message_content.h | 4 +- src/api/metadata/yaml/plugin_cleaning_data.h | 7 +- src/api/metadata/yaml/plugin_metadata.h | 12 +-- src/api/metadata/yaml/set.h | 4 +- src/api/metadata/yaml/tag.h | 4 +- src/api/plugin.h | 15 ++-- src/api/sorting/cyclic_interaction_error.cpp | 3 +- src/api/sorting/group_sort.cpp | 9 +- src/api/sorting/group_sort.h | 11 ++- src/api/sorting/plugin_graph.cpp | 5 +- src/api/sorting/plugin_graph.h | 6 +- src/api/sorting/plugin_sorting_data.cpp | 6 +- src/api/sorting/plugin_sorting_data.h | 13 +-- src/api/vertex.cpp | 3 +- .../api/interface/api_game_operations_test.h | 6 +- .../api/interface/create_game_handle_test.h | 17 ++-- src/tests/api/interface/game_interface_test.h | 25 +++--- src/tests/api/interface/is_compatible_test.h | 4 +- src/tests/api/interface/main.cpp | 37 ++++---- .../api/internals/game/game_cache_test.h | 11 ++- src/tests/api/internals/game/game_test.h | 42 +++++---- .../internals/game/load_order_handler_test.h | 31 +++---- src/tests/api/internals/helpers/crc_test.h | 1 - src/tests/api/internals/helpers/text_test.h | 12 +-- .../internals/helpers/yaml_set_helpers_test.h | 4 +- .../metadata/condition_evaluator_test.h | 51 +++++------ .../metadata/conditional_metadata_test.h | 15 ++-- src/tests/api/internals/metadata/file_test.h | 3 +- src/tests/api/internals/metadata/group_test.h | 19 ++-- .../api/internals/metadata/location_test.h | 8 +- .../internals/metadata/message_content_test.h | 3 +- .../api/internals/metadata/message_test.h | 8 +- src/tests/api/internals/metadata/tag_test.h | 10 +-- src/tests/api/internals/metadata_list_test.h | 2 +- .../api/internals/sorting/group_sort_test.h | 34 ++++--- .../api/internals/sorting/plugin_sort_test.h | 9 +- src/tests/common_game_test_fixture.h | 12 +-- src/tests/printers.h | 4 +- 64 files changed, 402 insertions(+), 401 deletions(-) diff --git a/include/loot/api.h b/include/loot/api.h index be9e3ea3..5501319f 100644 --- a/include/loot/api.h +++ b/include/loot/api.h @@ -43,9 +43,11 @@ namespace loot { /**@}*/ -/**********************************************************************//** - * @name Logging Functions - *************************************************************************/ +/**********************************************************************/ /** + * @name + *Logging + *Functions + *************************************************************************/ /**@{*/ /** @@ -60,9 +62,11 @@ LOOT_API void SetLoggingCallback( std::function callback); /**@}*/ -/**********************************************************************//** - * @name Version Functions - *************************************************************************/ +/**********************************************************************/ /** + * @name + *Version + *Functions + *************************************************************************/ /**@{*/ /** @@ -83,9 +87,12 @@ LOOT_API bool IsCompatible(const unsigned int major, const unsigned int patch); /**@}*/ -/**********************************************************************//** - * @name Lifecycle Management Functions - *************************************************************************/ +/**********************************************************************/ /** + * @name + *Lifecycle + *Management + *Functions + *************************************************************************/ /**@{*/ /** diff --git a/include/loot/database_interface.h b/include/loot/database_interface.h index 104fe0c3..f2e9d353 100644 --- a/include/loot/database_interface.h +++ b/include/loot/database_interface.h @@ -62,9 +62,10 @@ public: * should be loaded. If an empty path, no masterlist prelude will be * loaded. */ - virtual void LoadLists(const std::filesystem::path& masterlist_path, - const std::filesystem::path& userlist_path = "", - const std::filesystem::path& masterlist_prelude_path = "") = 0; + virtual void LoadLists( + const std::filesystem::path& masterlist_path, + const std::filesystem::path& userlist_path = "", + const std::filesystem::path& masterlist_prelude_path = "") = 0; /** * Writes a metadata file containing all loaded user-added metadata. diff --git a/include/loot/metadata/filename.h b/include/loot/metadata/filename.h index be37fa8d..8121b01d 100644 --- a/include/loot/metadata/filename.h +++ b/include/loot/metadata/filename.h @@ -47,6 +47,7 @@ public: LOOT_API explicit Filename(const std::string& filename); LOOT_API explicit operator std::string() const; + private: std::string filename_; }; @@ -56,7 +57,7 @@ private: * @returns True if the filenames are case-insensitively equal and all other * fields are case-sensitively equal, false otherwise. */ -LOOT_API bool operator==(const Filename& lhs,const Filename& rhs); +LOOT_API bool operator==(const Filename& lhs, const Filename& rhs); /** * Check if two Filename objects are not equal. @@ -65,32 +66,34 @@ LOOT_API bool operator==(const Filename& lhs,const Filename& rhs); LOOT_API bool operator!=(const Filename& lhs, const Filename& rhs); /** - * A less-than operator implemented with no semantics so that Filename objects can - * be stored in sets. - * @returns True if this Filename is less than the given Filename, false otherwise. + * A less-than operator implemented with no semantics so that Filename objects + * can be stored in sets. + * @returns True if this Filename is less than the given Filename, false + * otherwise. */ -LOOT_API bool operator<(const Filename& lhs,const Filename& rhs); +LOOT_API bool operator<(const Filename& lhs, const Filename& rhs); /** - * Check if the first Filename object is greater than the second Filename object. - * @returns True if the second Filename object is less than the first Filename object, - * false otherwise. + * Check if the first Filename object is greater than the second Filename + * object. + * @returns True if the second Filename object is less than the first Filename + * object, false otherwise. */ LOOT_API bool operator>(const Filename& lhs, const Filename& rhs); /** - * Check if the first Filename object is less than or equal to the second Filename - * object. - * @returns True if the first Filename object is not greater than the second Filename - * object, false otherwise. + * Check if the first Filename object is less than or equal to the second + * Filename object. + * @returns True if the first Filename object is not greater than the second + * Filename object, false otherwise. */ LOOT_API bool operator<=(const Filename& lhs, const Filename& rhs); /** - * Check if the first Filename object is greater than or equal to the second Filename - * object. - * @returns True if the first Filename object is not less than the second Filename - * object, false otherwise. + * Check if the first Filename object is greater than or equal to the second + * Filename object. + * @returns True if the first Filename object is not less than the second + * Filename object, false otherwise. */ LOOT_API bool operator>=(const Filename& lhs, const Filename& rhs); } diff --git a/include/loot/metadata/group.h b/include/loot/metadata/group.h index b6c5b83e..86c92158 100644 --- a/include/loot/metadata/group.h +++ b/include/loot/metadata/group.h @@ -54,8 +54,8 @@ public: * @return A Group object. */ LOOT_API explicit Group(const std::string& name, - const std::vector& afterGroups = {}, - const std::string& description = ""); + const std::vector& afterGroups = {}, + const std::string& description = ""); /** * Check if two Group objects are equal by comparing their names. diff --git a/include/loot/metadata/location.h b/include/loot/metadata/location.h index 5824ada5..bc0c37bd 100644 --- a/include/loot/metadata/location.h +++ b/include/loot/metadata/location.h @@ -49,12 +49,13 @@ public: * A name for the URL, eg. the page or site name. * @return A Location object. */ - LOOT_API explicit Location(const std::string& url, const std::string& name = ""); + LOOT_API explicit Location(const std::string& url, + const std::string& name = ""); /** * A less-than operator implemented with no semantics so that Location objects * can be stored in sets. - * @returns True if this Location is less than the given Location, false + * @returns True if this Location is less than the given Location, false * otherwise. */ LOOT_API bool operator<(const Location& rhs) const; @@ -89,7 +90,7 @@ private: LOOT_API bool operator!=(const Location& lhs, const Location& rhs); /** - * Check if the first Location object is greater than the second Location + * Check if the first Location object is greater than the second Location * object. * @returns True if the second Location object is less than the first Location * object, false otherwise. @@ -97,17 +98,17 @@ LOOT_API bool operator!=(const Location& lhs, const Location& rhs); LOOT_API bool operator>(const Location& lhs, const Location& rhs); /** - * Check if the first Location object is less than or equal to the second + * Check if the first Location object is less than or equal to the second * Location object. - * @returns True if the first Location object is not greater than the second + * @returns True if the first Location object is not greater than the second * Location object, false otherwise. */ LOOT_API bool operator<=(const Location& lhs, const Location& rhs); /** - * Check if the first Location object is greater than or equal to the second + * Check if the first Location object is greater than or equal to the second * Location object. - * @returns True if the first Location object is not less than the second + * @returns True if the first Location object is not less than the second * Location object, false otherwise. */ LOOT_API bool operator>=(const Location& lhs, const Location& rhs); diff --git a/include/loot/metadata/message.h b/include/loot/metadata/message.h index 5d0866d3..7d4eca20 100644 --- a/include/loot/metadata/message.h +++ b/include/loot/metadata/message.h @@ -58,8 +58,8 @@ public: * @return A Message object. */ LOOT_API explicit Message(const MessageType type, - const std::string& content, - const std::string& condition = ""); + const std::string& content, + const std::string& condition = ""); /** * Construct a Message object with the given type, content and condition @@ -73,8 +73,8 @@ public: * @return A Message object. */ LOOT_API explicit Message(const MessageType type, - const std::vector& content, - const std::string& condition = ""); + const std::vector& content, + const std::string& condition = ""); /** * Construct a Message object from a SimpleMessage object. @@ -117,7 +117,8 @@ public: * @return A MessageContent object for the preferred language, or for English * if a MessageContent object is not available for the given language. */ - LOOT_API std::optional GetContent(const std::string& language) const; + LOOT_API std::optional GetContent( + const std::string& language) const; /** * Get the message as a SimpleMessage given a language. @@ -126,7 +127,8 @@ public: * @return A SimpleMessage object for the preferred language, or for English * if message text is not available for the given language. */ - LOOT_API std::optional ToSimpleMessage(const std::string& language) const; + LOOT_API std::optional ToSimpleMessage( + const std::string& language) const; private: MessageType type_; diff --git a/include/loot/metadata/message_content.h b/include/loot/metadata/message_content.h index 6cab6319..62a502f3 100644 --- a/include/loot/metadata/message_content.h +++ b/include/loot/metadata/message_content.h @@ -24,9 +24,9 @@ #ifndef LOOT_METADATA_MESSAGE_CONTENT #define LOOT_METADATA_MESSAGE_CONTENT +#include #include #include -#include #include "loot/api_decorator.h" @@ -56,8 +56,9 @@ public: * The language that the message is written in. * @return A MessageContent object. */ - LOOT_API explicit MessageContent(const std::string& text, - const std::string& language = defaultLanguage); + LOOT_API explicit MessageContent( + const std::string& text, + const std::string& language = defaultLanguage); /** * Get the message text. diff --git a/include/loot/metadata/plugin_cleaning_data.h b/include/loot/metadata/plugin_cleaning_data.h index 5fb34037..c11199fe 100644 --- a/include/loot/metadata/plugin_cleaning_data.h +++ b/include/loot/metadata/plugin_cleaning_data.h @@ -76,12 +76,13 @@ public: * The number of deleted navmeshes found in the plugin. * @return A PluginCleaningData object. */ - LOOT_API explicit PluginCleaningData(uint32_t crc, - const std::string& utility, - const std::vector& detail, - unsigned int itm, - unsigned int ref, - unsigned int nav); + LOOT_API explicit PluginCleaningData( + uint32_t crc, + const std::string& utility, + const std::vector& detail, + unsigned int itm, + unsigned int ref, + unsigned int nav); /** * A less-than operator implemented with no semantics so that * PluginCleaningData objects can be stored in sets. @@ -144,7 +145,8 @@ public: * @return The MessageContent object for the preferred language, or if one * does not exist, the English-language MessageContent object. */ - LOOT_API std::optional ChooseDetail(const std::string& language) const; + LOOT_API std::optional ChooseDetail( + const std::string& language) const; private: uint32_t crc_; diff --git a/include/loot/metadata/tag.h b/include/loot/metadata/tag.h index 5ad2ecac..a42a49eb 100644 --- a/include/loot/metadata/tag.h +++ b/include/loot/metadata/tag.h @@ -95,15 +95,15 @@ LOOT_API bool operator!=(const Tag& lhs, const Tag& rhs); /** * Check if the first Tag object is greater than the second Tag object. - * @returns True if the second Tag object is less than the first Tag object, + * @returns True if the second Tag object is less than the first Tag object, * false otherwise. */ LOOT_API bool operator>(const Tag& lhs, const Tag& rhs); /** - * Check if the first Tag object is less than or equal to the second Tag + * Check if the first Tag object is less than or equal to the second Tag * object. - * @returns True if the first Tag object is not greater than the second Tag + * @returns True if the first Tag object is not greater than the second Tag * object, false otherwise. */ LOOT_API bool operator<=(const Tag& lhs, const Tag& rhs); @@ -111,7 +111,7 @@ LOOT_API bool operator<=(const Tag& lhs, const Tag& rhs); /** * Check if the first Tag object is greater than or equal to the second Tag * object. - * @returns True if the first Tag object is not less than the second Tag + * @returns True if the first Tag object is not less than the second Tag * object, false otherwise. */ LOOT_API bool operator>=(const Tag& lhs, const Tag& rhs); diff --git a/src/api/game/game.h b/src/api/game/game.h index 4af0b194..e9a73194 100644 --- a/src/api/game/game.h +++ b/src/api/game/game.h @@ -37,8 +37,8 @@ namespace loot { class Game : public GameInterface { public: explicit Game(const GameType gameType, - const std::filesystem::path& gamePath, - const std::filesystem::path& gameLocalDataPath = ""); + const std::filesystem::path& gamePath, + const std::filesystem::path& gameLocalDataPath = ""); // Internal Methods // ////////////////////// diff --git a/src/api/game/load_order_handler.h b/src/api/game/load_order_handler.h index 5073453c..8283c046 100644 --- a/src/api/game/load_order_handler.h +++ b/src/api/game/load_order_handler.h @@ -26,12 +26,11 @@ #define LOOT_API_GAME_LOAD_ORDER_HANDLER #include +#include #include -#include #include #include - -#include +#include #include "loot/enum/game_type.h" diff --git a/src/api/helpers/crc.cpp b/src/api/helpers/crc.cpp index 37c39e6f..aa9bc647 100644 --- a/src/api/helpers/crc.cpp +++ b/src/api/helpers/crc.cpp @@ -24,12 +24,10 @@ #include "api/helpers/crc.h" +#include #include -#include - #include "api/helpers/logging.h" - #include "loot/exception/file_access_error.h" using std::string; diff --git a/src/api/helpers/logging.h b/src/api/helpers/logging.h index b2af2c12..469308a0 100644 --- a/src/api/helpers/logging.h +++ b/src/api/helpers/logging.h @@ -30,8 +30,8 @@ #define NOMINMAX #endif -#include #include +#include #include "loot/enum/log_level.h" diff --git a/src/api/metadata/condition_evaluator.cpp b/src/api/metadata/condition_evaluator.cpp index 776b83a4..b8364c0e 100644 --- a/src/api/metadata/condition_evaluator.cpp +++ b/src/api/metadata/condition_evaluator.cpp @@ -43,8 +43,7 @@ void HandleError(const std::string operation, int returnCode) { lci_get_error_message(&message); if (message == nullptr) { err += "Error code: " + std::to_string(returnCode); - } - else { + } else { err += "Details: " + std::string(message); } @@ -58,26 +57,28 @@ void HandleError(const std::string operation, int returnCode) { int mapGameType(GameType gameType) { switch (gameType) { - case GameType::tes3: - return LCI_GAME_MORROWIND; - case GameType::tes4: - return LCI_GAME_OBLIVION; - case GameType::tes5: - return LCI_GAME_SKYRIM; - case GameType::tes5se: - return LCI_GAME_SKYRIM_SE; - case GameType::tes5vr: - return LCI_GAME_SKYRIM_VR; - case GameType::fo3: - return LCI_GAME_FALLOUT_3; - case GameType::fonv: - return LCI_GAME_FALLOUT_NV; - case GameType::fo4: - return LCI_GAME_FALLOUT_4; - case GameType::fo4vr: - return LCI_GAME_FALLOUT_4_VR; - default: - throw std::runtime_error("Unrecognised game type encountered while mapping for condition evaluation."); + case GameType::tes3: + return LCI_GAME_MORROWIND; + case GameType::tes4: + return LCI_GAME_OBLIVION; + case GameType::tes5: + return LCI_GAME_SKYRIM; + case GameType::tes5se: + return LCI_GAME_SKYRIM_SE; + case GameType::tes5vr: + return LCI_GAME_SKYRIM_VR; + case GameType::fo3: + return LCI_GAME_FALLOUT_3; + case GameType::fonv: + return LCI_GAME_FALLOUT_NV; + case GameType::fo4: + return LCI_GAME_FALLOUT_4; + case GameType::fo4vr: + return LCI_GAME_FALLOUT_4_VR; + default: + throw std::runtime_error( + "Unrecognised game type encountered while mapping for condition " + "evaluation."); } } @@ -87,19 +88,21 @@ std::string IntToHexString(const uint32_t value) { return stream.str(); } -ConditionEvaluator::ConditionEvaluator( - const GameType gameType, - const std::filesystem::path& dataPath) { - lci_state * state = nullptr; +ConditionEvaluator::ConditionEvaluator(const GameType gameType, + const std::filesystem::path& dataPath) { + lci_state* state = nullptr; - // This probably isn't correct for API users other than LOOT. - // But that probably doesn't matter, as the only things conditional - // on LOOT's version are LOOT-specific messages. - auto lootPath = std::filesystem::absolute("LOOT.exe"); - int result = lci_state_create(&state, mapGameType(gameType), dataPath.u8string().c_str(), lootPath.u8string().c_str()); - HandleError("create state object for condition evaluation", result); + // This probably isn't correct for API users other than LOOT. + // But that probably doesn't matter, as the only things conditional + // on LOOT's version are LOOT-specific messages. + auto lootPath = std::filesystem::absolute("LOOT.exe"); + int result = lci_state_create(&state, + mapGameType(gameType), + dataPath.u8string().c_str(), + lootPath.u8string().c_str()); + HandleError("create state object for condition evaluation", result); - lciState_ = std::shared_ptr(state, lci_state_destroy); + lciState_ = std::shared_ptr(state, lci_state_destroy); } bool ConditionEvaluator::Evaluate(const std::string& condition) { @@ -119,7 +122,8 @@ bool ConditionEvaluator::Evaluate(const std::string& condition) { return result == LCI_RESULT_TRUE; } -PluginMetadata ConditionEvaluator::EvaluateAll(const PluginMetadata& pluginMetadata) { +PluginMetadata ConditionEvaluator::EvaluateAll( + const PluginMetadata& pluginMetadata) { PluginMetadata evaluatedMetadata(pluginMetadata.GetName()); evaluatedMetadata.SetLocations(pluginMetadata.GetLocations()); @@ -190,7 +194,7 @@ void ConditionEvaluator::RefreshActivePluginsState( std::vector activePluginNames) { ClearConditionCache(); - std::vector activePluginNameCStrings; + std::vector activePluginNameCStrings; for (auto& pluginName : activePluginNames) { activePluginNameCStrings.push_back(pluginName.c_str()); } @@ -202,7 +206,8 @@ void ConditionEvaluator::RefreshActivePluginsState( cActivePluginNames = &activePluginNameCStrings[0]; } - int result = lci_state_set_active_plugins(lciState_.get(), cActivePluginNames, activePluginNameCStrings.size()); + int result = lci_state_set_active_plugins( + lciState_.get(), cActivePluginNames, activePluginNameCStrings.size()); HandleError("cache active plugins for condition evaluation", result); } @@ -244,8 +249,8 @@ void ConditionEvaluator::RefreshLoadedPluginsState( cPluginVersions = &pluginVersions[0]; } - int result = lci_state_set_plugin_versions(lciState_.get(), cPluginVersions, - pluginVersions.size()); + int result = lci_state_set_plugin_versions( + lciState_.get(), cPluginVersions, pluginVersions.size()); HandleError("cache plugin versions for condition evaluation", result); const plugin_crc* cPluginCrcs; @@ -255,17 +260,18 @@ void ConditionEvaluator::RefreshLoadedPluginsState( cPluginCrcs = &pluginCrcs[0]; } - result = lci_state_set_crc_cache(lciState_.get(), cPluginCrcs, - pluginCrcs.size()); + result = + lci_state_set_crc_cache(lciState_.get(), cPluginCrcs, pluginCrcs.size()); HandleError("fill CRC cache for condition evaluation", result); } bool ConditionEvaluator::Evaluate(const PluginCleaningData& cleaningData, - const std::string& pluginName) { + const std::string& pluginName) { if (pluginName.empty()) return false; - return Evaluate("checksum(\"" + pluginName + "\", " + IntToHexString(cleaningData.GetCRC()) + ")"); + return Evaluate("checksum(\"" + pluginName + "\", " + + IntToHexString(cleaningData.GetCRC()) + ")"); } void ParseCondition(const std::string& condition) { diff --git a/src/api/metadata/condition_evaluator.h b/src/api/metadata/condition_evaluator.h index 41ac97eb..e37bfc61 100644 --- a/src/api/metadata/condition_evaluator.h +++ b/src/api/metadata/condition_evaluator.h @@ -25,11 +25,11 @@ #ifndef LOOT_API_METADATA_CONDITION_EVALUATOR #define LOOT_API_METADATA_CONDITION_EVALUATOR +#include + #include #include -#include - #include "api/game/game_cache.h" #include "api/game/load_order_handler.h" #include "loot/metadata/plugin_cleaning_data.h" @@ -39,18 +39,19 @@ namespace loot { class ConditionEvaluator { public: explicit ConditionEvaluator(const GameType gameType, - const std::filesystem::path& dataPath); + const std::filesystem::path& dataPath); bool Evaluate(const std::string& condition); PluginMetadata EvaluateAll(const PluginMetadata& pluginMetadata); void ClearConditionCache(); void RefreshActivePluginsState(std::vector activePluginNames); - void RefreshLoadedPluginsState(std::vector> plugins); + void RefreshLoadedPluginsState( + std::vector> plugins); private: bool Evaluate(const PluginCleaningData& cleaningData, - const std::string& pluginName); + const std::string& pluginName); std::shared_ptr lciState_; }; diff --git a/src/api/metadata/file.cpp b/src/api/metadata/file.cpp index 6e733ae9..4cc325aa 100644 --- a/src/api/metadata/file.cpp +++ b/src/api/metadata/file.cpp @@ -84,7 +84,8 @@ std::string File::GetDisplayName() const { std::vector File::GetDetail() const { return detail_; } -std::optional File::ChooseDetail(const std::string& language) const { +std::optional File::ChooseDetail( + const std::string& language) const { return MessageContent::Choose(detail_, language); } diff --git a/src/api/metadata/filename.cpp b/src/api/metadata/filename.cpp index a5e0b2bd..36c01fc8 100644 --- a/src/api/metadata/filename.cpp +++ b/src/api/metadata/filename.cpp @@ -29,8 +29,7 @@ namespace loot { Filename::Filename() {} -Filename::Filename(const std::string& filename) : - filename_(filename) {} +Filename::Filename(const std::string& filename) : filename_(filename) {} Filename::operator std::string() const { return filename_; } @@ -38,7 +37,9 @@ bool operator==(const Filename& lhs, const Filename& rhs) { return CompareFilenames(std::string(lhs), std::string(rhs)) == 0; } -bool operator!=(const Filename& lhs, const Filename& rhs) { return !(lhs == rhs); } +bool operator!=(const Filename& lhs, const Filename& rhs) { + return !(lhs == rhs); +} bool operator<(const Filename& lhs, const Filename& rhs) { return CompareFilenames(std::string(lhs), std::string(rhs)) < 0; @@ -46,7 +47,11 @@ bool operator<(const Filename& lhs, const Filename& rhs) { bool operator>(const Filename& lhs, const Filename& rhs) { return rhs < lhs; } -bool operator<=(const Filename& lhs, const Filename& rhs) { return !(lhs > rhs); } +bool operator<=(const Filename& lhs, const Filename& rhs) { + return !(lhs > rhs); +} -bool operator>=(const Filename& lhs, const Filename& rhs) { return !(lhs < rhs); } +bool operator>=(const Filename& lhs, const Filename& rhs) { + return !(lhs < rhs); +} } diff --git a/src/api/metadata/group.cpp b/src/api/metadata/group.cpp index b5cf80b3..cb716cbf 100644 --- a/src/api/metadata/group.cpp +++ b/src/api/metadata/group.cpp @@ -32,9 +32,7 @@ Group::Group() : name_("default") {} Group::Group(const std::string& name, const std::vector& afterGroups, const std::string& description) : - name_(name), - afterGroups_(afterGroups), - description_(description) {} + name_(name), afterGroups_(afterGroups), description_(description) {} bool Group::operator==(const Group& rhs) const { return name_ == rhs.name_ && description_ == rhs.description_ && @@ -65,13 +63,9 @@ std::string Group::GetName() const { return name_; } std::string Group::GetDescription() const { return description_; } -std::vector Group::GetAfterGroups() const { - return afterGroups_; -} +std::vector Group::GetAfterGroups() const { return afterGroups_; } -bool operator!=(const Group& lhs, const Group& rhs) { - return !(lhs == rhs); -} +bool operator!=(const Group& lhs, const Group& rhs) { return !(lhs == rhs); } bool operator>(const Group& lhs, const Group& rhs) { return rhs < lhs; } diff --git a/src/api/metadata/location.cpp b/src/api/metadata/location.cpp index ec652220..1da3dead 100644 --- a/src/api/metadata/location.cpp +++ b/src/api/metadata/location.cpp @@ -28,8 +28,7 @@ namespace loot { Location::Location() {} Location::Location(const std::string& url, const std::string& name) : - url_(url), - name_(name) {} + url_(url), name_(name) {} bool Location::operator<(const Location& rhs) const { if (url_ < rhs.url_) { diff --git a/src/api/metadata/message.cpp b/src/api/metadata/message.cpp index f2d8790e..04356ffc 100644 --- a/src/api/metadata/message.cpp +++ b/src/api/metadata/message.cpp @@ -34,16 +34,14 @@ Message::Message() : type_(MessageType::say) {} Message::Message(const MessageType type, const std::string& content, const std::string& condition) : - type_(type), + type_(type), content_({MessageContent(content)}), ConditionalMetadata(condition) {} Message::Message(const MessageType type, const std::vector& content, const std::string& condition) : - type_(type), - content_(content), - ConditionalMetadata(condition) { + type_(type), content_(content), ConditionalMetadata(condition) { if (content.size() > 1) { bool englishStringExists = false; for (const auto& mc : content) { diff --git a/src/api/metadata/message_content.cpp b/src/api/metadata/message_content.cpp index 0fe4134d..9e19b9c0 100644 --- a/src/api/metadata/message_content.cpp +++ b/src/api/metadata/message_content.cpp @@ -24,9 +24,8 @@ #include "loot/metadata/message_content.h" -#include - #include +#include namespace loot { const std::string MessageContent::defaultLanguage = "en"; @@ -59,7 +58,7 @@ bool MessageContent::operator==(const MessageContent& rhs) const { std::optional MessageContent::Choose( const std::vector content, - const std::string& language) { + const std::string& language) { if (content.empty()) return std::nullopt; else if (content.size() == 1) diff --git a/src/api/metadata/plugin_cleaning_data.cpp b/src/api/metadata/plugin_cleaning_data.cpp index 6d790a15..a482a065 100644 --- a/src/api/metadata/plugin_cleaning_data.cpp +++ b/src/api/metadata/plugin_cleaning_data.cpp @@ -33,18 +33,15 @@ PluginCleaningData::PluginCleaningData() : crc_(0), itm_(0), ref_(0), nav_(0) {} PluginCleaningData::PluginCleaningData(uint32_t crc, const std::string& utility) : - crc_(crc), - utility_(utility), - itm_(0), - ref_(0), - nav_(0) {} + crc_(crc), utility_(utility), itm_(0), ref_(0), nav_(0) {} -PluginCleaningData::PluginCleaningData(uint32_t crc, - const std::string& utility, - const std::vector& detail, - unsigned int itm, - unsigned int ref, - unsigned int nav) : +PluginCleaningData::PluginCleaningData( + uint32_t crc, + const std::string& utility, + const std::vector& detail, + unsigned int itm, + unsigned int ref, + unsigned int nav) : crc_(crc), itm_(itm), ref_(ref), @@ -97,8 +94,9 @@ bool PluginCleaningData::operator<(const PluginCleaningData& rhs) const { } bool PluginCleaningData::operator==(const PluginCleaningData& rhs) const { - return crc_ == rhs.crc_ && utility_ == rhs.utility_ && detail_ == rhs.detail_ && - itm_ == rhs.itm_ && ref_ == rhs.ref_ && nav_ == rhs.nav_; + return crc_ == rhs.crc_ && utility_ == rhs.utility_ && + detail_ == rhs.detail_ && itm_ == rhs.itm_ && ref_ == rhs.ref_ && + nav_ == rhs.nav_; } uint32_t PluginCleaningData::GetCRC() const { return crc_; } diff --git a/src/api/metadata/tag.cpp b/src/api/metadata/tag.cpp index d708b196..7b46122a 100644 --- a/src/api/metadata/tag.cpp +++ b/src/api/metadata/tag.cpp @@ -32,9 +32,7 @@ Tag::Tag() : addTag_(true) {} Tag::Tag(const std::string& tag, const bool isAddition, const std::string& condition) : - name_(tag), - addTag_(isAddition), - ConditionalMetadata(condition) {} + name_(tag), addTag_(isAddition), ConditionalMetadata(condition) {} bool Tag::operator<(const Tag& rhs) const { if (addTag_ != rhs.addTag_) { diff --git a/src/api/metadata/yaml/group.h b/src/api/metadata/yaml/group.h index 5808bab8..cfdfca2b 100644 --- a/src/api/metadata/yaml/group.h +++ b/src/api/metadata/yaml/group.h @@ -26,11 +26,11 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + #include #include -#include - #include "api/metadata/yaml/set.h" #include "loot/metadata/group.h" diff --git a/src/api/metadata/yaml/location.h b/src/api/metadata/yaml/location.h index ac24989f..9409f39a 100644 --- a/src/api/metadata/yaml/location.h +++ b/src/api/metadata/yaml/location.h @@ -26,11 +26,11 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + #include #include -#include - #include "loot/metadata/location.h" namespace YAML { diff --git a/src/api/metadata/yaml/message.h b/src/api/metadata/yaml/message.h index 41b92e3f..17cd04ea 100644 --- a/src/api/metadata/yaml/message.h +++ b/src/api/metadata/yaml/message.h @@ -26,12 +26,12 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + +#include #include #include -#include -#include - #include "loot/metadata/message.h" namespace YAML { diff --git a/src/api/metadata/yaml/message_content.h b/src/api/metadata/yaml/message_content.h index 7cbfa105..5e9e5b71 100644 --- a/src/api/metadata/yaml/message_content.h +++ b/src/api/metadata/yaml/message_content.h @@ -26,10 +26,10 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS -#include - #include +#include + #include "loot/metadata/message_content.h" namespace YAML { diff --git a/src/api/metadata/yaml/plugin_cleaning_data.h b/src/api/metadata/yaml/plugin_cleaning_data.h index 1aae874d..cfac0179 100644 --- a/src/api/metadata/yaml/plugin_cleaning_data.h +++ b/src/api/metadata/yaml/plugin_cleaning_data.h @@ -27,11 +27,11 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + #include #include -#include - #include "loot/metadata/plugin_cleaning_data.h" namespace YAML { @@ -83,7 +83,8 @@ struct convert { if (node["detail"].IsSequence()) detail = node["detail"].as>(); else { - detail.push_back(loot::MessageContent(node["detail"].as())); + detail.push_back( + loot::MessageContent(node["detail"].as())); } } diff --git a/src/api/metadata/yaml/plugin_metadata.h b/src/api/metadata/yaml/plugin_metadata.h index 571aade4..b1773ce6 100644 --- a/src/api/metadata/yaml/plugin_metadata.h +++ b/src/api/metadata/yaml/plugin_metadata.h @@ -26,6 +26,8 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + #include #include #include @@ -33,10 +35,6 @@ #include #include -#include - -#include "loot/metadata/plugin_metadata.h" - #include "api/metadata/yaml/file.h" #include "api/metadata/yaml/location.h" #include "api/metadata/yaml/message.h" @@ -44,6 +42,7 @@ #include "api/metadata/yaml/plugin_cleaning_data.h" #include "api/metadata/yaml/set.h" #include "api/metadata/yaml/tag.h" +#include "loot/metadata/plugin_metadata.h" namespace YAML { template<> @@ -117,7 +116,7 @@ struct convert { node["dirty"].as>()); } if (node["clean"]) { - rhs.SetCleanInfo( + rhs.SetCleanInfo( node["clean"].as>()); } if (node["url"]) @@ -133,7 +132,8 @@ inline Emitter& operator<<(Emitter& out, const loot::PluginMetadata& rhs) { << rhs.GetName(); if (rhs.GetGroup()) - out << Key << "group" << Value << YAML::SingleQuoted << rhs.GetGroup().value(); + out << Key << "group" << Value << YAML::SingleQuoted + << rhs.GetGroup().value(); if (!rhs.GetLoadAfterFiles().empty()) out << Key << "after" << Value << rhs.GetLoadAfterFiles(); diff --git a/src/api/metadata/yaml/set.h b/src/api/metadata/yaml/set.h index 333c4fc0..0f35f92c 100644 --- a/src/api/metadata/yaml/set.h +++ b/src/api/metadata/yaml/set.h @@ -27,11 +27,11 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS +#include + #include #include -#include - namespace YAML { template struct convert> { diff --git a/src/api/metadata/yaml/tag.h b/src/api/metadata/yaml/tag.h index dfeb7dbf..a1c945e6 100644 --- a/src/api/metadata/yaml/tag.h +++ b/src/api/metadata/yaml/tag.h @@ -26,10 +26,10 @@ #define YAML_CPP_SUPPORT_MERGE_KEYS -#include - #include +#include + #include "loot/metadata/tag.h" namespace YAML { diff --git a/src/api/plugin.h b/src/api/plugin.h index cca7d26b..5665cbf8 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -25,14 +25,13 @@ #define LOOT_API_PLUGIN #include +#include #include #include #include #include #include -#include - #include "api/game/load_order_handler.h" #include "loot/enum/game_type.h" #include "loot/metadata/plugin_metadata.h" @@ -44,9 +43,9 @@ class GameCache; class Plugin : public PluginInterface { public: explicit Plugin(const GameType gameType, - std::shared_ptr gameCache, - std::filesystem::path pluginPath, - const bool headerOnly); + std::shared_ptr gameCache, + std::filesystem::path pluginPath, + const bool headerOnly); std::string GetName() const; std::optional GetHeaderVersion() const; @@ -104,9 +103,11 @@ std::string GetArchiveFileExtension(const GameType gameType); bool hasPluginFileExtension(std::string filename, GameType gameType); -bool equivalent(const std::filesystem::path& path1, const std::filesystem::path& path2); +bool equivalent(const std::filesystem::path& path1, + const std::filesystem::path& path2); -std::filesystem::path replaceExtension(std::filesystem::path path, const std::string& newExtension); +std::filesystem::path replaceExtension(std::filesystem::path path, + const std::string& newExtension); } #endif diff --git a/src/api/sorting/cyclic_interaction_error.cpp b/src/api/sorting/cyclic_interaction_error.cpp index f39521a0..8a2189d1 100644 --- a/src/api/sorting/cyclic_interaction_error.cpp +++ b/src/api/sorting/cyclic_interaction_error.cpp @@ -32,7 +32,8 @@ std::string describeCycle(const std::vector& cycle) { for (const auto& vertex : cycle) { text += vertex.GetName(); if (vertex.GetTypeOfEdgeToNextVertex().has_value()) { - text += " --[" + describeEdgeType(vertex.GetTypeOfEdgeToNextVertex().value()) + + text += " --[" + + describeEdgeType(vertex.GetTypeOfEdgeToNextVertex().value()) + "]-> "; } } diff --git a/src/api/sorting/group_sort.cpp b/src/api/sorting/group_sort.cpp index ed2106c2..b60aace2 100644 --- a/src/api/sorting/group_sort.cpp +++ b/src/api/sorting/group_sort.cpp @@ -237,11 +237,10 @@ vertex_t GetVertexByName(const GroupGraph& graph, const std::string& name) { throw std::invalid_argument("Can't find group with name \"" + name + "\""); } -std::vector GetGroupsPath( - const std::vector& masterlistGroups, - const std::vector& userGroups, - const std::string& fromGroupName, - const std::string& toGroupName) { +std::vector GetGroupsPath(const std::vector& masterlistGroups, + const std::vector& userGroups, + const std::string& fromGroupName, + const std::string& toGroupName) { GroupGraph graph = BuildGraph(masterlistGroups, userGroups); auto logger = getLogger(); diff --git a/src/api/sorting/group_sort.h b/src/api/sorting/group_sort.h index a22a0e50..ce7efa3c 100644 --- a/src/api/sorting/group_sort.h +++ b/src/api/sorting/group_sort.h @@ -30,8 +30,8 @@ #include #include -#include "loot/vertex.h" #include "loot/metadata/group.h" +#include "loot/vertex.h" namespace loot { // Map entries are a group name and names of transitive load after groups. @@ -39,10 +39,9 @@ std::unordered_map> GetTransitiveAfterGroups(const std::vector& masterlistGroups, const std::vector& userGroups); -std::vector GetGroupsPath( - const std::vector& masterlistGroups, - const std::vector& userGroups, - const std::string& fromGroupName, - const std::string& toGroupName); +std::vector GetGroupsPath(const std::vector& masterlistGroups, + const std::vector& userGroups, + const std::string& fromGroupName, + const std::string& toGroupName); } #endif diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index 4521e87a..88ca6535 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -24,13 +24,12 @@ #include "plugin_graph.h" -#include -#include - #include #include #include #include +#include +#include #include "api/game/game.h" #include "api/helpers/logging.h" diff --git a/src/api/sorting/plugin_graph.h b/src/api/sorting/plugin_graph.h index 0cd4d54e..cb851663 100644 --- a/src/api/sorting/plugin_graph.h +++ b/src/api/sorting/plugin_graph.h @@ -27,12 +27,12 @@ #define FMT_NO_FMT_STRING_ALIAS -#include - #include + #include #include #include +#include #include "api/game/game.h" #include "api/plugin.h" @@ -82,7 +82,7 @@ class PluginGraph { public: size_t CountVertices() const; void CheckForCycles() const; - + void AddPluginVertices(Game& game, const std::vector& loadOrder); void AddSpecificEdges(); void AddHardcodedPluginEdges(Game& game); diff --git a/src/api/sorting/plugin_sorting_data.cpp b/src/api/sorting/plugin_sorting_data.cpp index 23bd2c5a..18ae3606 100644 --- a/src/api/sorting/plugin_sorting_data.cpp +++ b/src/api/sorting/plugin_sorting_data.cpp @@ -24,9 +24,10 @@ #include "plugin_sorting_data.h" +#include + #include -#include #include "api/helpers/text.h" namespace loot { @@ -134,7 +135,8 @@ void PluginSortingData::SetAfterGroupPlugins( afterGroupPlugins_ = plugins; } -const std::vector& PluginSortingData::GetMasterlistLoadAfterFiles() const { +const std::vector& PluginSortingData::GetMasterlistLoadAfterFiles() + const { return masterlistLoadAfter_; } diff --git a/src/api/sorting/plugin_sorting_data.h b/src/api/sorting/plugin_sorting_data.h index f70db48e..8fd5f3ce 100644 --- a/src/api/sorting/plugin_sorting_data.h +++ b/src/api/sorting/plugin_sorting_data.h @@ -31,12 +31,13 @@ namespace loot { class PluginSortingData { public: - explicit PluginSortingData(const Plugin& plugin, - const PluginMetadata& masterlistMetadata, - const PluginMetadata& userMetadata, - const std::vector& loadOrder, - const GameType gameType, - const std::vector>& loadedPlugins); + explicit PluginSortingData( + const Plugin& plugin, + const PluginMetadata& masterlistMetadata, + const PluginMetadata& userMetadata, + const std::vector& loadOrder, + const GameType gameType, + const std::vector>& loadedPlugins); std::string GetName() const; bool IsMaster() const; diff --git a/src/api/vertex.cpp b/src/api/vertex.cpp index 39ec6e43..fb6a345b 100644 --- a/src/api/vertex.cpp +++ b/src/api/vertex.cpp @@ -27,8 +27,7 @@ namespace loot { Vertex::Vertex(std::string name) : name_(name) {} Vertex::Vertex(std::string name, EdgeType outEdgeType) : - name_(name), - outEdgeType_(outEdgeType) {} + name_(name), outEdgeType_(outEdgeType) {} std::string Vertex::GetName() const { return name_; } diff --git a/src/tests/api/interface/api_game_operations_test.h b/src/tests/api/interface/api_game_operations_test.h index e3acf57c..7b84a996 100644 --- a/src/tests/api/interface/api_game_operations_test.h +++ b/src/tests/api/interface/api_game_operations_test.h @@ -25,10 +25,9 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERFACE_API_GAME_OPERATIONS_TEST #define LOOT_TESTS_API_INTERFACE_API_GAME_OPERATIONS_TEST -#include "loot/api.h" - #include +#include "loot/api.h" #include "tests/common_game_test_fixture.h" namespace loot { @@ -52,8 +51,7 @@ protected: ASSERT_FALSE(std::filesystem::exists(masterlistPath)); - handle_ = CreateGameHandle( - GetParam(), dataPath.parent_path(), localPath); + handle_ = CreateGameHandle(GetParam(), dataPath.parent_path(), localPath); } void GenerateMasterlist() { diff --git a/src/tests/api/interface/create_game_handle_test.h b/src/tests/api/interface/create_game_handle_test.h index c480ac1a..b17a7d06 100644 --- a/src/tests/api/interface/create_game_handle_test.h +++ b/src/tests/api/interface/create_game_handle_test.h @@ -25,10 +25,9 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERFACE_CREATE_GAME_HANDLE_TEST #define LOOT_TESTS_API_INTERFACE_CREATE_GAME_HANDLE_TEST -#include "loot/api.h" - #include +#include "loot/api.h" #include "tests/common_game_test_fixture.h" namespace loot { @@ -85,13 +84,13 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - CreateGameHandleTest, - ::testing::Values(GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + CreateGameHandleTest, + ::testing::Values(GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(CreateGameHandleTest, shouldSucceedIfPassedValidParametersWithRelativePaths) { diff --git a/src/tests/api/interface/game_interface_test.h b/src/tests/api/interface/game_interface_test.h index 46c7c792..c92733a3 100644 --- a/src/tests/api/interface/game_interface_test.h +++ b/src/tests/api/interface/game_interface_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERFACE_GAME_INTERFACE_TEST #include "loot/api.h" - #include "tests/api/interface/api_game_operations_test.h" namespace loot { @@ -51,7 +50,7 @@ protected: }) { // Make sure the plugin with a non-ASCII filename exists. std::filesystem::copy_file(dataPath / blankEsm, - dataPath / std::filesystem::u8path(nonAsciiEsm)); + dataPath / std::filesystem::u8path(nonAsciiEsm)); } const std::string emptyFile; @@ -62,19 +61,20 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - GameInterfaceTest, - ::testing::Values(GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + GameInterfaceTest, + ::testing::Values(GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(GameInterfaceTest, isValidPluginShouldReturnTrueForAValidPlugin) { EXPECT_TRUE(handle_->IsValidPlugin(blankEsm)); } -TEST_P(GameInterfaceTest, isValidPluginShouldReturnTrueForAValidNonAsciiPlugin) { +TEST_P(GameInterfaceTest, + isValidPluginShouldReturnTrueForAValidNonAsciiPlugin) { EXPECT_TRUE(handle_->IsValidPlugin(nonAsciiEsm)); } @@ -121,7 +121,7 @@ TEST_P(GameInterfaceTest, } TEST_P(GameInterfaceTest, loadPluginsWithANonAsciiPluginShouldLoadIt) { - handle_->LoadPlugins({ nonAsciiEsm }, false); + handle_->LoadPlugins({nonAsciiEsm}, false); EXPECT_EQ(1, handle_->GetLoadedPlugins().size()); // Check that one plugin's header has been read. @@ -161,8 +161,7 @@ TEST_P(GameInterfaceTest, sortPluginsShouldSucceedIfPassedValidArguments) { } ASSERT_NO_THROW(GenerateMasterlist()); - ASSERT_NO_THROW( - handle_->GetDatabase()->LoadLists(masterlistPath, "")); + ASSERT_NO_THROW(handle_->GetDatabase()->LoadLists(masterlistPath, "")); std::vector pluginsToSort({ blankEsp, diff --git a/src/tests/api/interface/is_compatible_test.h b/src/tests/api/interface/is_compatible_test.h index de8128d4..2c20b644 100644 --- a/src/tests/api/interface/is_compatible_test.h +++ b/src/tests/api/interface/is_compatible_test.h @@ -25,10 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERFACE_IS_COMPATIBLE_TEST #define LOOT_TESTS_API_INTERFACE_IS_COMPATIBLE_TEST -#include "loot/api.h" - #include +#include "loot/api.h" + namespace loot { namespace test { TEST(IsCompatible, diff --git a/src/tests/api/interface/main.cpp b/src/tests/api/interface/main.cpp index 669889cb..c5b1609d 100644 --- a/src/tests/api/interface/main.cpp +++ b/src/tests/api/interface/main.cpp @@ -62,35 +62,40 @@ TEST(SetLoggingCallback, shouldAcceptAFreeFunction) { TEST(SetLoggingCallback, shouldAcceptAMemberFunction) { TestLogger testLogger; - auto boundCallback = std::bind(&TestLogger::callback, &testLogger, std::placeholders::_1, std::placeholders::_2); + auto boundCallback = std::bind(&TestLogger::callback, + &testLogger, + std::placeholders::_1, + std::placeholders::_2); SetLoggingCallback(boundCallback); try { CreateGameHandle(GameType::tes4, "dummy"); FAIL(); - } - catch (...) { + } catch (...) { EXPECT_EQ( - "Attempting to create a game handle with game path \"dummy\" " - "and local path \"\"", - testLogger.loggedMessages); + "Attempting to create a game handle with game path \"dummy\" " + "and local path \"\"", + testLogger.loggedMessages); SetLoggingCallback([](LogLevel, const char *) {}); } } -TEST(SetLoggingCallback, shouldNotBreakLoggingIfPassedMemberFunctionGoesOutOfScope) { +TEST(SetLoggingCallback, + shouldNotBreakLoggingIfPassedMemberFunctionGoesOutOfScope) { { TestLogger testLogger; - auto boundCallback = std::bind(&TestLogger::callback, &testLogger, std::placeholders::_1, std::placeholders::_2); + auto boundCallback = std::bind(&TestLogger::callback, + &testLogger, + std::placeholders::_1, + std::placeholders::_2); SetLoggingCallback(boundCallback); } try { CreateGameHandle(GameType::tes4, "dummy"); FAIL(); - } - catch (...) { + } catch (...) { SetLoggingCallback([](LogLevel, const char *) {}); } } @@ -115,7 +120,8 @@ TEST(SetLoggingCallback, shouldAcceptALambdaFunction) { } } -TEST(SetLoggingCallback, shouldNotBreakLoggingIfPassedLambdaFunctionGoesOutOfScope) { +TEST(SetLoggingCallback, + shouldNotBreakLoggingIfPassedLambdaFunctionGoesOutOfScope) { std::string loggedMessages; { SetLoggingCallback([&](LogLevel, const char *string) { @@ -126,12 +132,11 @@ TEST(SetLoggingCallback, shouldNotBreakLoggingIfPassedLambdaFunctionGoesOutOfSco try { CreateGameHandle(GameType::tes4, "dummy"); FAIL(); - } - catch (...) { + } catch (...) { EXPECT_EQ( - "Attempting to create a game handle with game path \"dummy\" " - "and local path \"\"", - loggedMessages); + "Attempting to create a game handle with game path \"dummy\" " + "and local path \"\"", + loggedMessages); SetLoggingCallback([](LogLevel, const char *) {}); } diff --git a/src/tests/api/internals/game/game_cache_test.h b/src/tests/api/internals/game/game_cache_test.h index 7198242e..f9f2c2a4 100644 --- a/src/tests/api/internals/game/game_cache_test.h +++ b/src/tests/api/internals/game/game_cache_test.h @@ -25,9 +25,8 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_GAME_GAME_CACHE_TEST #define LOOT_TESTS_API_INTERNALS_GAME_GAME_CACHE_TEST -#include "api/game/game_cache.h" - #include "api/game/game.h" +#include "api/game/game_cache.h" #include "tests/common_game_test_fixture.h" namespace loot { @@ -107,18 +106,18 @@ TEST_P(GameCacheTest, } TEST_P(GameCacheTest, - gettingArchivePathsShouldReturnAnEmptySetIfNoPathsHaveBeenCached) { + gettingArchivePathsShouldReturnAnEmptySetIfNoPathsHaveBeenCached) { EXPECT_TRUE(cache_.GetArchivePaths().empty()); } TEST_P(GameCacheTest, - gettingArchivePathsShouldReturnASetOfPathsIfPathsHaveBeenCached) { + gettingArchivePathsShouldReturnASetOfPathsIfPathsHaveBeenCached) { cache_.CacheArchivePaths({game_.DataPath() / blankEsm, game_.DataPath() / blankMasterDependentEsm}); auto expected = std::set({ - game_.DataPath() / blankEsm, - game_.DataPath() / blankMasterDependentEsm, + game_.DataPath() / blankEsm, + game_.DataPath() / blankMasterDependentEsm, }); EXPECT_EQ(expected, cache_.GetArchivePaths()); diff --git a/src/tests/api/internals/game/game_test.h b/src/tests/api/internals/game/game_test.h index fd5bd415..eec4f361 100644 --- a/src/tests/api/internals/game/game_test.h +++ b/src/tests/api/internals/game/game_test.h @@ -26,16 +26,13 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_GAME_GAME_TEST #include "api/game/game.h" - #include "tests/common_game_test_fixture.h" namespace loot { namespace test { class GameTest : public CommonGameTestFixture { protected: - GameTest() : - blankArchive("Blank" + GetArchiveFileExtension(GetParam())) { - + GameTest() : blankArchive("Blank" + GetArchiveFileExtension(GetParam())) { std::ofstream out(dataPath / blankArchive); out.close(); } @@ -63,13 +60,13 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - GameTest, - ::testing::Values(GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + GameTest, + ::testing::Values(GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(GameTest, constructingShouldStoreTheGivenValues) { Game game = Game(GetParam(), dataPath.parent_path(), localPath); @@ -127,7 +124,7 @@ TEST_P(GameTest, loadPluginsWithAnInvalidPluginShouldNotAddItToTheLoadedPlugins) { ASSERT_FALSE(std::filesystem::exists(dataPath / invalidPlugin)); ASSERT_NO_THROW(std::filesystem::copy_file(dataPath / blankEsm, - dataPath / invalidPlugin)); + dataPath / invalidPlugin)); ASSERT_TRUE(std::filesystem::exists(dataPath / invalidPlugin)); std::ofstream out(dataPath / invalidPlugin, std::fstream::app); out << "GRUP0"; @@ -156,20 +153,18 @@ TEST_P(GameTest, EXPECT_EQ(blankEsmCrc, plugin->GetCRC().value()); } -TEST_P(GameTest, - loadPluginsShouldFindAndCacheArchivesForLoadDetectionWhenLoadingPlugins) { +TEST_P( + GameTest, + loadPluginsShouldFindAndCacheArchivesForLoadDetectionWhenLoadingPlugins) { Game game = Game(GetParam(), dataPath.parent_path(), localPath); EXPECT_NO_THROW(loadInstalledPlugins(game, false)); - auto expected = std::set({ - dataPath / blankArchive - }); + auto expected = std::set({dataPath / blankArchive}); EXPECT_EQ(expected, game.GetCache()->GetArchivePaths()); } -TEST_P(GameTest, - loadPluginsShouldClearTheArchivesCacheBeforeFindingArchives) { +TEST_P(GameTest, loadPluginsShouldClearTheArchivesCacheBeforeFindingArchives) { Game game = Game(GetParam(), dataPath.parent_path(), localPath); EXPECT_NO_THROW(loadInstalledPlugins(game, false)); @@ -177,9 +172,12 @@ TEST_P(GameTest, EXPECT_EQ(1, game.GetCache()->GetArchivePaths().size()); } -TEST_P(GameTest, - loadPluginsShouldNotThrowIfAFilenameHasNonWindows1252EncodableCharacters) { - auto path = dataPath / std::filesystem::u8path(u8"\u2551\u00BB\u00C1\u2510\u2557\u00FE\u00C3\u00CE.txt"); +TEST_P( + GameTest, + loadPluginsShouldNotThrowIfAFilenameHasNonWindows1252EncodableCharacters) { + auto path = + dataPath / std::filesystem::u8path( + u8"\u2551\u00BB\u00C1\u2510\u2557\u00FE\u00C3\u00CE.txt"); std::ofstream out(path); out.close(); diff --git a/src/tests/api/internals/game/load_order_handler_test.h b/src/tests/api/internals/game/load_order_handler_test.h index a70b2c5d..bc6c6149 100644 --- a/src/tests/api/internals/game/load_order_handler_test.h +++ b/src/tests/api/internals/game/load_order_handler_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_LOAD_ORDER_HANDLER_TEST #include "api/game/load_order_handler.h" - #include "tests/common_game_test_fixture.h" namespace loot { @@ -107,14 +106,14 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - LoadOrderHandlerTest, - ::testing::Values(GameType::tes3, - GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + LoadOrderHandlerTest, + ::testing::Values(GameType::tes3, + GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(LoadOrderHandlerTest, initShouldThrowIfNoGamePathIsSet) { EXPECT_THROW(loadOrderHandler_.Init(GetParam(), ""), std::invalid_argument); @@ -182,25 +181,21 @@ TEST_P(LoadOrderHandlerTest, getLoadOrderShouldReturnTheCurrentLoadOrder) { } TEST_P(LoadOrderHandlerTest, - getActivePluginsShouldThrowIfTheHandlerHasNotBeenInitialised) { - EXPECT_THROW(loadOrderHandler_.GetActivePlugins(), - std::system_error); + getActivePluginsShouldThrowIfTheHandlerHasNotBeenInitialised) { + EXPECT_THROW(loadOrderHandler_.GetActivePlugins(), std::system_error); } TEST_P(LoadOrderHandlerTest, - getActivePluginsShouldReturnAnEmptyVectorIfStateHasNotBeenLoaded) { + getActivePluginsShouldReturnAnEmptyVectorIfStateHasNotBeenLoaded) { initialiseHandler(); EXPECT_TRUE(loadOrderHandler_.GetActivePlugins().empty()); } -TEST_P( - LoadOrderHandlerTest, - getActivePluginsShouldReturnOnlyActivePlugins) { +TEST_P(LoadOrderHandlerTest, getActivePluginsShouldReturnOnlyActivePlugins) { initialiseHandler(); loadOrderHandler_.LoadCurrentState(); - ASSERT_EQ(getActivePlugins(), - loadOrderHandler_.GetActivePlugins()); + ASSERT_EQ(getActivePlugins(), loadOrderHandler_.GetActivePlugins()); } TEST_P(LoadOrderHandlerTest, diff --git a/src/tests/api/internals/helpers/crc_test.h b/src/tests/api/internals/helpers/crc_test.h index cdba9023..bc648eff 100644 --- a/src/tests/api/internals/helpers/crc_test.h +++ b/src/tests/api/internals/helpers/crc_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_HELPERS_CRC_TEST #include "api/helpers/crc.h" - #include "loot/exception/file_access_error.h" #include "tests/common_game_test_fixture.h" diff --git a/src/tests/api/internals/helpers/text_test.h b/src/tests/api/internals/helpers/text_test.h index 06179a5b..5eacfb70 100644 --- a/src/tests/api/internals/helpers/text_test.h +++ b/src/tests/api/internals/helpers/text_test.h @@ -25,11 +25,11 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_HELPERS_TEXT_TEST #define LOOT_TESTS_API_INTERNALS_HELPERS_TEXT_TEST +#include + #include "api/helpers/text.h" #include "loot/loot_version.h" -#include - namespace loot { namespace test { @@ -204,12 +204,12 @@ TEST(CompareFilenames, shouldBeCaseInsensitiveAndLocaleInvariant) { // ICU sees all three greek rhos as case-insensitively equal, unlike Windows. // A small enough deviation that it should hopefully be insignificant. #ifdef _WIN32 - const char * turkishLocale = "tr-TR"; - const char * greekLocale = "el-GR"; + const char* turkishLocale = "tr-TR"; + const char* greekLocale = "el-GR"; const int expectedRhoSymbolOrder = 1; #else - const char * turkishLocale = "tr_TR.UTF-8"; - const char * greekLocale = "el_GR.UTF-8"; + const char* turkishLocale = "tr_TR.UTF-8"; + const char* greekLocale = "el_GR.UTF-8"; const int expectedRhoSymbolOrder = 0; #endif diff --git a/src/tests/api/internals/helpers/yaml_set_helpers_test.h b/src/tests/api/internals/helpers/yaml_set_helpers_test.h index e66f80ec..c4320404 100644 --- a/src/tests/api/internals/helpers/yaml_set_helpers_test.h +++ b/src/tests/api/internals/helpers/yaml_set_helpers_test.h @@ -25,10 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_HELPERS_YAML_SET_HELPERS_TEST #define LOOT_TESTS_API_INTERNALS_HELPERS_YAML_SET_HELPERS_TEST -#include "api/metadata/yaml/set.h" - #include +#include "api/metadata/yaml/set.h" + namespace loot { namespace test { TEST(set, encodingAsYamlShouldStoreAllValuesInSetOrder) { diff --git a/src/tests/api/internals/metadata/condition_evaluator_test.h b/src/tests/api/internals/metadata/condition_evaluator_test.h index 78dcd8db..bd8202c0 100644 --- a/src/tests/api/internals/metadata/condition_evaluator_test.h +++ b/src/tests/api/internals/metadata/condition_evaluator_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_METADATA_CONDITION_EVALUATOR_TEST #include "api/metadata/condition_evaluator.h" - #include "loot/exception/condition_syntax_error.h" #include "tests/common_game_test_fixture.h" @@ -39,13 +38,12 @@ protected: MessageContent("info"), })), game_(GetParam(), dataPath.parent_path(), localPath), - evaluator_(game_.Type(), - game_.DataPath()), + evaluator_(game_.Type(), game_.DataPath()), nonAsciiEsm(u8"non\u00C1scii.esm"), nonAsciiNestedFile(u8"non\u00C1scii/test.txt") { // Make sure the plugin with a non-ASCII filename exists. std::filesystem::copy_file(dataPath / blankEsm, - dataPath / std::filesystem::u8path(nonAsciiEsm)); + dataPath / std::filesystem::u8path(nonAsciiEsm)); auto nonAsciiPath = dataPath / std::filesystem::u8path(nonAsciiNestedFile); std::filesystem::create_directory(nonAsciiPath.parent_path()); @@ -79,7 +77,7 @@ protected: blankPluginDependentEsp, blankDifferentPluginDependentEsp, nonAsciiEsm, - }); + }); if (GetParam() == GameType::fo4 || GetParam() == GameType::tes5se) { plugins.push_back(blankEsl); @@ -101,14 +99,14 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - ConditionEvaluatorTest, - ::testing::Values(GameType::tes3, - GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + ConditionEvaluatorTest, + ::testing::Values(GameType::tes3, + GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(ConditionEvaluatorTest, evaluateShouldReturnTrueForAnEmptyConditionString) { @@ -125,37 +123,38 @@ TEST_P(ConditionEvaluatorTest, } TEST_P(ConditionEvaluatorTest, - evaluateFileConditionShouldReturnTrueForANonAsciiFileThatExists) { + evaluateFileConditionShouldReturnTrueForANonAsciiFileThatExists) { EXPECT_TRUE(evaluator_.Evaluate("file(\"" + nonAsciiEsm + "\")")); } TEST_P(ConditionEvaluatorTest, - evaluateChecksumConditionShouldBeAbleToGetTheCrcOfANonAsciiFile) { + evaluateChecksumConditionShouldBeAbleToGetTheCrcOfANonAsciiFile) { std::string condition("checksum(\"" + nonAsciiEsm + "\", " + - IntToHexString(blankEsmCrc) + ")"); + IntToHexString(blankEsmCrc) + ")"); EXPECT_TRUE(evaluator_.Evaluate(condition)); } TEST_P(ConditionEvaluatorTest, - evaluateVersionConditionShouldBeAbleToGetTheVersionOfANonAsciiFile) { + evaluateVersionConditionShouldBeAbleToGetTheVersionOfANonAsciiFile) { std::string condition("version(\"" + nonAsciiEsm + "\", \"5.0\", ==)"); EXPECT_TRUE(evaluator_.Evaluate(condition)); } TEST_P(ConditionEvaluatorTest, - evaluateActiveConditionShouldReturnTrueForAnActivePlugin) { + evaluateActiveConditionShouldReturnTrueForAnActivePlugin) { std::string condition("active(\"" + blankEsm + "\")"); EXPECT_TRUE(evaluator_.Evaluate(condition)); } TEST_P(ConditionEvaluatorTest, - evaluateRegexFileConditionShouldReturnTrueForANonAsciiFileThatExists) { + evaluateRegexFileConditionShouldReturnTrueForANonAsciiFileThatExists) { std::string condition(u8"file(\"non\u00C1scii.*\\.esm\")"); EXPECT_TRUE(evaluator_.Evaluate(condition)); } -TEST_P(ConditionEvaluatorTest, - evaluateRegexFileConditionShouldReturnTrueForANonAsciiNestedFileThatExists) { +TEST_P( + ConditionEvaluatorTest, + evaluateRegexFileConditionShouldReturnTrueForANonAsciiNestedFileThatExists) { std::string condition(u8"file(\"non\u00C1scii/.+\\.txt\")"); EXPECT_TRUE(evaluator_.Evaluate(condition)); } @@ -209,7 +208,7 @@ TEST_P(ConditionEvaluatorTest, evaluateAllShouldPreserveGroupExplicitness) { } TEST_P(ConditionEvaluatorTest, - refreshActivePluginsStateShouldClearTheConditionCache) { + refreshActivePluginsStateShouldClearTheConditionCache) { std::string condition("active(\"" + blankEsm + "\")"); ASSERT_TRUE(evaluator_.Evaluate(condition)); @@ -218,8 +217,9 @@ TEST_P(ConditionEvaluatorTest, EXPECT_FALSE(evaluator_.Evaluate(condition)); } -TEST_P(ConditionEvaluatorTest, - refreshActivePluginsStateShouldClearTheActivePluginsCacheIfGivenAnEmptyVector) { +TEST_P( + ConditionEvaluatorTest, + refreshActivePluginsStateShouldClearTheActivePluginsCacheIfGivenAnEmptyVector) { std::string condition("active(\"" + blankEsm + "\")"); ASSERT_TRUE(evaluator_.Evaluate(condition)); @@ -245,7 +245,8 @@ TEST_P(ConditionEvaluatorTest, EXPECT_FALSE(evaluator_.Evaluate(condition)); } -TEST_P(ConditionEvaluatorTest, +TEST_P( + ConditionEvaluatorTest, refreshLoadedPluginsStateShouldClearTheVersionsCacheIfGivenAnEmptyVector) { std::string condition("version(\"" + blankEsm + "\", \"5.0\", ==)"); diff --git a/src/tests/api/internals/metadata/conditional_metadata_test.h b/src/tests/api/internals/metadata/conditional_metadata_test.h index c1e78af6..5532e495 100644 --- a/src/tests/api/internals/metadata/conditional_metadata_test.h +++ b/src/tests/api/internals/metadata/conditional_metadata_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_METADATA_CONDITIONAL_METADATA_TEST #include "loot/metadata/conditional_metadata.h" - #include "tests/common_game_test_fixture.h" namespace loot { @@ -39,13 +38,13 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - ConditionalMetadataTest, - ::testing::Values(GameType::tes4, - GameType::tes5, - GameType::fo3, - GameType::fonv, - GameType::fo4, - GameType::tes5se)); + ConditionalMetadataTest, + ::testing::Values(GameType::tes4, + GameType::tes5, + GameType::fo3, + GameType::fonv, + GameType::fo4, + GameType::tes5se)); TEST_P(ConditionalMetadataTest, defaultConstructorShouldSetEmptyConditionString) { diff --git a/src/tests/api/internals/metadata/file_test.h b/src/tests/api/internals/metadata/file_test.h index f515e370..48261ae3 100644 --- a/src/tests/api/internals/metadata/file_test.h +++ b/src/tests/api/internals/metadata/file_test.h @@ -532,8 +532,7 @@ TEST(File, decodingFromYamlWithAListOfMessageContentDetailsShouldReadThemAll) { EXPECT_EQ(expectedDetail, file.GetDetail()); } -TEST(File, - decodingFromYamlShouldNotThrowIfTheOnlyDetailStringIsNotEnglish) { +TEST(File, decodingFromYamlShouldNotThrowIfTheOnlyDetailStringIsNotEnglish) { YAML::Node node = YAML::Load( "name: name1\n" "detail:\n" diff --git a/src/tests/api/internals/metadata/group_test.h b/src/tests/api/internals/metadata/group_test.h index 708b351b..10e7c1e1 100644 --- a/src/tests/api/internals/metadata/group_test.h +++ b/src/tests/api/internals/metadata/group_test.h @@ -25,11 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_METADATA_GROUP_TEST #define LOOT_TESTS_API_INTERNALS_METADATA_GROUP_TEST -#include "loot/metadata/group.h" - #include #include "api/metadata/yaml/group.h" +#include "loot/metadata/group.h" namespace loot { namespace test { @@ -54,8 +53,7 @@ TEST(Group, allArgsConstructorShouldStoreGivenValues) { EXPECT_EQ("group1", group.GetName()); EXPECT_EQ("test", group.GetDescription()); - EXPECT_EQ(std::vector({"other_group"}), - group.GetAfterGroups()); + EXPECT_EQ(std::vector({"other_group"}), group.GetAfterGroups()); } TEST(Group, equalityShouldBeCaseSensitiveOnNameAndDescription) { @@ -198,9 +196,8 @@ TEST(Group, lessThanOperatorShouldCompareAfterGroups) { EXPECT_FALSE(group2 < group1); } -TEST( - Group, - greaterThanOperatorShouldReturnTrueIfTheSecondGroupIsLessThanTheFirst) { +TEST(Group, + greaterThanOperatorShouldReturnTrueIfTheSecondGroupIsLessThanTheFirst) { Group group1("name", {}, "description"); Group group2("name", {}, "description"); @@ -250,8 +247,9 @@ TEST( EXPECT_TRUE(group2 > group1); } -TEST(Group, - lessThanOrEqualToOperatorShouldReturnTrueIfTheFirstGroupIsNotGreaterThanTheSecond) { +TEST( + Group, + lessThanOrEqualToOperatorShouldReturnTrueIfTheFirstGroupIsNotGreaterThanTheSecond) { Group group1("name", {}, "description"); Group group2("name", {}, "description"); @@ -301,7 +299,8 @@ TEST(Group, EXPECT_FALSE(group2 <= group1); } -TEST(Group, +TEST( + Group, greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstGroupIsNotLessThanTheSecond) { Group group1("name", {}, "description"); Group group2("name", {}, "description"); diff --git a/src/tests/api/internals/metadata/location_test.h b/src/tests/api/internals/metadata/location_test.h index 6365b79f..edc761e6 100644 --- a/src/tests/api/internals/metadata/location_test.h +++ b/src/tests/api/internals/metadata/location_test.h @@ -25,11 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_METADATA_LOCATION_TEST #define LOOT_TESTS_API_INTERNALS_METADATA_LOCATION_TEST -#include "loot/metadata/location.h" - #include #include "api/metadata/yaml/location.h" +#include "loot/metadata/location.h" namespace loot { namespace test { @@ -202,8 +201,9 @@ TEST( EXPECT_TRUE(location1 <= location2); } -TEST(Location, - greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstLocationIsNotLessThanTheSecond) { +TEST( + Location, + greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstLocationIsNotLessThanTheSecond) { Location location1("http://www.example.com", "example"); Location location2("http://www.example.com", "example"); diff --git a/src/tests/api/internals/metadata/message_content_test.h b/src/tests/api/internals/metadata/message_content_test.h index bff9ffe1..0695d131 100644 --- a/src/tests/api/internals/metadata/message_content_test.h +++ b/src/tests/api/internals/metadata/message_content_test.h @@ -239,8 +239,7 @@ TEST( EXPECT_TRUE(content1 >= content2); } -TEST(MessageContent, - chooseShouldReturnANulloptIfTheVectorIsEmpty) { +TEST(MessageContent, chooseShouldReturnANulloptIfTheVectorIsEmpty) { auto content = MessageContent::Choose(std::vector(), "fr"); EXPECT_FALSE(content.has_value()); diff --git a/src/tests/api/internals/metadata/message_test.h b/src/tests/api/internals/metadata/message_test.h index e224f590..8c002300 100644 --- a/src/tests/api/internals/metadata/message_test.h +++ b/src/tests/api/internals/metadata/message_test.h @@ -25,10 +25,9 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_METADATA_MESSAGE_TEST #define LOOT_TESTS_API_INTERNALS_METADATA_MESSAGE_TEST -#include "loot/metadata/message.h" - #include "api/game/game.h" #include "api/metadata/yaml/message.h" +#include "loot/metadata/message.h" #include "tests/common_game_test_fixture.h" namespace loot { @@ -83,7 +82,7 @@ TEST_P( } TEST_P(MessageTest, - simpleMessageConstructorShouldCreateAMessageWithASingleContentString) { + simpleMessageConstructorShouldCreateAMessageWithASingleContentString) { SimpleMessage simple; simple.type = MessageType::error; simple.text = "ERROR"; @@ -398,7 +397,8 @@ TEST_P(MessageTest, getContentShouldSelectTheContentStringIfOnlyOneExists) { MessageContent("content1", french), })); - EXPECT_EQ("content1", + EXPECT_EQ( + "content1", message.GetContent(MessageContent::defaultLanguage).value().GetText()); } diff --git a/src/tests/api/internals/metadata/tag_test.h b/src/tests/api/internals/metadata/tag_test.h index 15d32275..01a2bd01 100644 --- a/src/tests/api/internals/metadata/tag_test.h +++ b/src/tests/api/internals/metadata/tag_test.h @@ -25,11 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_METADATA_TAG_TEST #define LOOT_TESTS_API_INTERNALS_METADATA_TAG_TEST -#include "loot/metadata/tag.h" - #include #include "api/metadata/yaml/tag.h" +#include "loot/metadata/tag.h" namespace loot { namespace test { @@ -168,8 +167,7 @@ TEST(Tag, lessThanOperatorShouldTreatTagAdditionsAsBeingLessThanRemovals) { EXPECT_FALSE(tag2 < tag1); } -TEST( - Tag, greaterThanOperatorShouldReturnTrueIfTheSecondTagIsLessThanTheFirst) { +TEST(Tag, greaterThanOperatorShouldReturnTrueIfTheSecondTagIsLessThanTheFirst) { Tag tag1("name", true, "condition"); Tag tag2("name", true, "condition"); @@ -207,7 +205,9 @@ TEST( EXPECT_TRUE(tag2 > tag1); } -TEST(Tag, lessThanOrEqualOperatorShouldReturnTrueIfTheFirstTagIsNotGreaterThanTheSecond) { +TEST( + Tag, + lessThanOrEqualOperatorShouldReturnTrueIfTheFirstTagIsNotGreaterThanTheSecond) { Tag tag1("name", true, "condition"); Tag tag2("name", true, "condition"); diff --git a/src/tests/api/internals/metadata_list_test.h b/src/tests/api/internals/metadata_list_test.h index 5d034dbb..9390fac8 100644 --- a/src/tests/api/internals/metadata_list_test.h +++ b/src/tests/api/internals/metadata_list_test.h @@ -564,7 +564,7 @@ plugins: } TEST(ReplaceMetadataListPrelude, - shouldSucceedIfGivenAFlowStylePreludeAndABlockStyleMasterlist) { + shouldSucceedIfGivenAFlowStylePreludeAndABlockStyleMasterlist) { std::string prelude = "globals: [{type: note, content: A message.}]"; std::string masterlist = R"(prelude: a: b diff --git a/src/tests/api/internals/sorting/group_sort_test.h b/src/tests/api/internals/sorting/group_sort_test.h index ec377628..3762d2b1 100644 --- a/src/tests/api/internals/sorting/group_sort_test.h +++ b/src/tests/api/internals/sorting/group_sort_test.h @@ -25,18 +25,16 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_API_INTERNALS_SORTING_GROUP_SORT_TEST #define LOOT_TESTS_API_INTERNALS_SORTING_GROUP_SORT_TEST -#include "api/sorting/group_sort.h" - #include +#include "api/sorting/group_sort.h" #include "loot/exception/cyclic_interaction_error.h" #include "loot/exception/undefined_group_error.h" namespace loot { namespace test { TEST(GetTransitiveAfterGroups, shouldMapGroupsToTheirTransitiveAfterGroups) { - std::vector groups( - {Group("a"), Group("b", {"a"}), Group("c", {"b"})}); + std::vector groups({Group("a"), Group("b", {"a"}), Group("c", {"b"})}); auto mapped = GetTransitiveAfterGroups(groups, {}); @@ -119,10 +117,10 @@ TEST(GetGroupsPath, shouldThrowIfTheToGroupDoesNotExist) { TEST(GetGroupsPath, shouldReturnAnEmptyVectorIfThereIsNoPathBetweenTheTwoGroups) { std::vector groups({Group("a", {}), - Group("b", {"a"}), - Group("c", {"a"}), - Group("d", {"c"}), - Group("e", {"b", "d"})}); + Group("b", {"a"}), + Group("c", {"a"}), + Group("d", {"c"}), + Group("e", {"b", "d"})}); auto path = GetGroupsPath(groups, {}, "b", "d"); @@ -132,10 +130,10 @@ TEST(GetGroupsPath, TEST(GetGroupsPath, shouldFindThePathWithTheLeastNumberOfEdgesInAMasterlistOnlyGraph) { std::vector groups({Group("a", {}), - Group("b", {"a"}), - Group("c", {"a"}), - Group("d", {"c"}), - Group("e", {"b", "d"})}); + Group("b", {"a"}), + Group("c", {"a"}), + Group("d", {"c"}), + Group("e", {"b", "d"})}); auto path = GetGroupsPath(groups, {}, "a", "e"); @@ -153,9 +151,9 @@ TEST(GetGroupsPath, TEST(GetGroupsPath, shouldFindThePathWithTheLeastNumberOfEdgesThatContainsUserMetadata) { std::vector groups({Group("a", {}), - Group("b", {"a"}), - Group("c", {"a"}), - Group("e", {"b"})}); + Group("b", {"a"}), + Group("c", {"a"}), + Group("e", {"b"})}); std::vector userGroups({Group("d", {"c"}), Group("e", {"d"})}); auto path = GetGroupsPath(groups, userGroups, "a", "e"); @@ -176,9 +174,9 @@ TEST(GetGroupsPath, TEST(GetGroupsPath, shouldThrowIfMasterlistGroupLoadsAfterAUserlistGroup) { std::vector groups({Group("a", {}), - Group("b", {"a"}), - Group("c", {"a"}), - Group("e", {"b", "d"})}); + Group("b", {"a"}), + Group("c", {"a"}), + Group("e", {"b", "d"})}); std::vector userGroups({Group("d", {"c"})}); EXPECT_THROW(GetGroupsPath(groups, userGroups, "a", "e"), diff --git a/src/tests/api/internals/sorting/plugin_sort_test.h b/src/tests/api/internals/sorting/plugin_sort_test.h index da28dd4e..09d19c24 100644 --- a/src/tests/api/internals/sorting/plugin_sort_test.h +++ b/src/tests/api/internals/sorting/plugin_sort_test.h @@ -26,7 +26,6 @@ along with LOOT. If not, see #define LOOT_TESTS_API_INTERNALS_SORTING_PLUGIN_SORT_TEST #include "api/sorting/plugin_sort.h" - #include "loot/exception/cyclic_interaction_error.h" #include "loot/exception/undefined_group_error.h" #include "tests/common_game_test_fixture.h" @@ -126,10 +125,10 @@ protected: // Pass an empty first argument, as it's a prefix for the test instantation, // but we only have the one so no prefix is necessary. INSTANTIATE_TEST_SUITE_P(, - PluginSortTest, - ::testing::Values(GameType::tes3, - GameType::tes4, - GameType::fo4)); + PluginSortTest, + ::testing::Values(GameType::tes3, + GameType::tes4, + GameType::fo4)); TEST_P(PluginSortTest, sortingWithNoLoadedPluginsShouldReturnAnEmptyList) { std::vector sorted = SortPlugins(game_, game_.GetLoadOrder()); diff --git a/src/tests/common_game_test_fixture.h b/src/tests/common_game_test_fixture.h index 573e9ee3..cf3b35f7 100644 --- a/src/tests/common_game_test_fixture.h +++ b/src/tests/common_game_test_fixture.h @@ -25,18 +25,18 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_COMMON_GAME_TEST_FIXTURE #define LOOT_TESTS_COMMON_GAME_TEST_FIXTURE +#include + +#include +#include +#include +#include #include #include #include #include #include -#include -#include -#include -#include -#include - #include "loot/enum/game_type.h" namespace loot { diff --git a/src/tests/printers.h b/src/tests/printers.h index 1ba2a11c..c55222e6 100644 --- a/src/tests/printers.h +++ b/src/tests/printers.h @@ -25,10 +25,10 @@ along with LOOT. If not, see #ifndef LOOT_TESTS_PRINTERS #define LOOT_TESTS_PRINTERS -#include - #include +#include + #include "api/metadata/message_content.h" #include "api/plugin.h" #include "loot/metadata/file.h"