From d4de7399f2cc8b4a090a9babbf5c95fa6a514b9a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 18 Feb 2018 09:51:22 +0000 Subject: [PATCH] Run clang-format --- src/api/api.cpp | 7 ++-- src/api/game/load_order_handler.cpp | 2 +- src/api/plugin/plugin_sorter.cpp | 3 +- src/api/plugin/plugin_sorter.h | 8 ++--- .../api/interface/database_interface_test.h | 16 ++++++--- src/tests/api/interface/game_interface_test.h | 22 ++++++------ src/tests/api/interface/main.cpp | 7 ++-- .../api/internals/metadata/message_test.h | 22 +++++++----- .../metadata/plugin_cleaning_data_test.h | 3 +- src/tests/api/internals/metadata_list_test.h | 24 +++++++------ .../api/internals/plugin/plugin_sorter_test.h | 36 ++++++++++++------- src/tests/api/internals/plugin/plugin_test.h | 2 +- 12 files changed, 93 insertions(+), 59 deletions(-) diff --git a/src/api/api.cpp b/src/api/api.cpp index a0d1e588..17cf32d3 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -72,8 +72,11 @@ LOOT_API std::shared_ptr CreateGameHandle( const std::string& gameLocalPath) { auto logger = getLogger(); if (logger) { - logger->info("Attempting to create a game handle with game path \"{}\" " - "and local path \"{}\"", gamePath, gameLocalPath); + logger->info( + "Attempting to create a game handle with game path \"{}\" " + "and local path \"{}\"", + gamePath, + gameLocalPath); } const std::string resolvedGamePath = ResolvePath(gamePath); diff --git a/src/api/game/load_order_handler.cpp b/src/api/game/load_order_handler.cpp index 773c2b44..af332efe 100644 --- a/src/api/game/load_order_handler.cpp +++ b/src/api/game/load_order_handler.cpp @@ -77,7 +77,7 @@ void LoadOrderHandler::Init(const GameType& gameType, &gh_, LIBLO_GAME_FO4, gamePath.string().c_str(), gameLocalDataPath); else if (gameType == GameType::fo4vr) ret = lo_create_handle( - &gh_, LIBLO_GAME_FO4VR, gamePath.string().c_str(), gameLocalDataPath); + &gh_, LIBLO_GAME_FO4VR, gamePath.string().c_str(), gameLocalDataPath); else ret = LIBLO_ERROR_INVALID_ARGS; diff --git a/src/api/plugin/plugin_sorter.cpp b/src/api/plugin/plugin_sorter.cpp index 798b1179..892c5711 100644 --- a/src/api/plugin/plugin_sorter.cpp +++ b/src/api/plugin/plugin_sorter.cpp @@ -50,7 +50,8 @@ PluginSortingData::PluginSortingData(const Plugin& plugin, std::string PluginSortingData::GetName() const { return plugin_.GetName(); } bool PluginSortingData::IsMaster() const { - return plugin_.IsMaster() || (plugin_.IsLightMaster() && !boost::iends_with(plugin_.GetName(), ".esp")); + return plugin_.IsMaster() || (plugin_.IsLightMaster() && + !boost::iends_with(plugin_.GetName(), ".esp")); } bool PluginSortingData::LoadsArchive() const { return plugin_.LoadsArchive(); } diff --git a/src/api/plugin/plugin_sorter.h b/src/api/plugin/plugin_sorter.h index 09fced0c..6f9af8e3 100644 --- a/src/api/plugin/plugin_sorter.h +++ b/src/api/plugin/plugin_sorter.h @@ -46,12 +46,12 @@ public: size_t NumOverrideFormIDs() const; bool DoFormIDsOverlap(const PluginSortingData& plugin) const; - using PluginMetadata::GetLocalPriority; - using PluginMetadata::SetLocalPriority; using PluginMetadata::GetGlobalPriority; - using PluginMetadata::SetGlobalPriority; - using PluginMetadata::GetRequirements; using PluginMetadata::GetLoadAfterFiles; + using PluginMetadata::GetLocalPriority; + using PluginMetadata::GetRequirements; + using PluginMetadata::SetGlobalPriority; + using PluginMetadata::SetLocalPriority; private: const Plugin& plugin_; diff --git a/src/tests/api/interface/database_interface_test.h b/src/tests/api/interface/database_interface_test.h index 16a453c5..de1b550a 100644 --- a/src/tests/api/interface/database_interface_test.h +++ b/src/tests/api/interface/database_interface_test.h @@ -407,7 +407,10 @@ TEST_P(DatabaseInterfaceTest, auto tags = db_->GetKnownBashTags(); std::set expectedTags({ - "RaceRelations", "C.Lighting", "Actors.ACBS", "C.Climate", + "RaceRelations", + "C.Lighting", + "Actors.ACBS", + "C.Climate", }); EXPECT_EQ(expectedTags, tags); } @@ -458,7 +461,8 @@ TEST_P( auto metadata = db_->GetPluginMetadata(blankEsm, true); std::set expectedLoadAfter({ - File(masterFile), File(blankDifferentEsm), + File(masterFile), + File(blankDifferentEsm), }); EXPECT_EQ(expectedLoadAfter, metadata.GetLoadAfterFiles()); } @@ -648,7 +652,10 @@ TEST_P(DatabaseInterfaceTest, auto tags = db_->GetKnownBashTags(); std::set expectedTags({ - "RaceRelations", "C.Lighting", "Actors.ACBS", "C.Climate", + "RaceRelations", + "C.Lighting", + "Actors.ACBS", + "C.Climate", }); EXPECT_EQ(expectedTags, tags); } @@ -686,7 +693,8 @@ TEST_P( auto tags = db_->GetKnownBashTags(); std::set expectedTags({ - "Actors.ACBS", "C.Climate", + "Actors.ACBS", + "C.Climate", }); EXPECT_EQ(expectedTags, tags); } diff --git a/src/tests/api/interface/game_interface_test.h b/src/tests/api/interface/game_interface_test.h index 0c049ae1..5faba652 100644 --- a/src/tests/api/interface/game_interface_test.h +++ b/src/tests/api/interface/game_interface_test.h @@ -149,17 +149,17 @@ TEST_P(GameInterfaceTest, sortPluginsShouldSucceedIfPassedValidArguments) { handle_->GetDatabase()->LoadLists(masterlistPath.string(), "")); std::vector pluginsToSort({ - blankEsp, - blankPluginDependentEsp, - blankDifferentMasterDependentEsm, - blankMasterDependentEsp, - blankDifferentMasterDependentEsp, - blankDifferentEsp, - blankDifferentPluginDependentEsp, - masterFile, - blankEsm, - blankMasterDependentEsm, - blankDifferentEsm, + blankEsp, + blankPluginDependentEsp, + blankDifferentMasterDependentEsm, + blankMasterDependentEsp, + blankDifferentMasterDependentEsp, + blankDifferentEsp, + blankDifferentPluginDependentEsp, + masterFile, + blankEsm, + blankMasterDependentEsm, + blankDifferentEsm, }); if (GetParam() == GameType::fo4 || GetParam() == GameType::tes5se) { diff --git a/src/tests/api/interface/main.cpp b/src/tests/api/interface/main.cpp index e27cace0..c88900c8 100644 --- a/src/tests/api/interface/main.cpp +++ b/src/tests/api/interface/main.cpp @@ -53,9 +53,10 @@ TEST(SetLoggingCallback, shouldWriteMessagesToGivenCallback) { try { CreateGameHandle(GameType::tes4, "dummy"); } catch (...) { - EXPECT_EQ("Attempting to create a game handle with game path \"dummy\" " - "and local path \"\"", - loggedMessages); + EXPECT_EQ( + "Attempting to create a game handle with game path \"dummy\" " + "and local path \"\"", + loggedMessages); SetLoggingCallback([](LogLevel, const char *) {}); return; diff --git a/src/tests/api/internals/metadata/message_test.h b/src/tests/api/internals/metadata/message_test.h index 79d70571..9ced0ac6 100644 --- a/src/tests/api/internals/metadata/message_test.h +++ b/src/tests/api/internals/metadata/message_test.h @@ -61,7 +61,8 @@ TEST_P(MessageTest, TEST_P(MessageTest, vectorContentConstructorShouldCreateAMessageWithGivenContentStrings) { MessageContents contents({ - MessageContent("content1"), MessageContent("content2", french), + MessageContent("content1"), + MessageContent("content2", french), }); Message message(MessageType::error, contents, "condition1"); @@ -74,7 +75,8 @@ TEST_P( MessageTest, vectorContentConstructorShouldThrowIfMultipleContentStringsAreGivenAndNoneAreEnglish) { MessageContents contents({ - MessageContent("content1", german), MessageContent("content2", french), + MessageContent("content1", german), + MessageContent("content2", french), }); EXPECT_THROW(Message(MessageType::error, contents, "condition1"), std::invalid_argument); @@ -125,11 +127,11 @@ TEST_P(MessageTest, getContentShouldReturnADefaultContentObjectIfNoneExists) { TEST_P( MessageTest, getContentShouldSelectTheEnglishStringIfThereIsNoStringForTheGivenLanguage) { - Message message( - MessageType::say, - MessageContents({ - MessageContent("content1", german), MessageContent("content2"), - })); + Message message(MessageType::say, + MessageContents({ + MessageContent("content1", german), + MessageContent("content2"), + })); EXPECT_EQ("content2", message.GetContent(french).GetText()); } @@ -284,7 +286,8 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreASingleContentStringInAVector) { TEST_P(MessageTest, encodingAsYamlShouldMultipleContentStringsInAVector) { MessageContents contents({ - MessageContent("content1"), MessageContent("content2", french), + MessageContent("content1"), + MessageContent("content2", french), }); Message message(MessageType::say, contents); YAML::Node node; @@ -370,7 +373,8 @@ TEST_P(MessageTest, decodingFromYamlShouldStoreAListOfContentStringsCorrectly) { Message message = node.as(); EXPECT_EQ(MessageContents({ - MessageContent("content1"), MessageContent("content2", french), + MessageContent("content1"), + MessageContent("content2", french), }), message.GetContent()); } diff --git a/src/tests/api/internals/metadata/plugin_cleaning_data_test.h b/src/tests/api/internals/metadata/plugin_cleaning_data_test.h index 3c0eb1f0..167e2f2c 100644 --- a/src/tests/api/internals/metadata/plugin_cleaning_data_test.h +++ b/src/tests/api/internals/metadata/plugin_cleaning_data_test.h @@ -113,7 +113,8 @@ TEST_P( chooseInfoShouldSelectTheEnglishStringIfNoStringExistsForTheGivenLanguage) { MessageContent content("content1", MessageContent::defaultLanguage); std::vector info({ - content, MessageContent("content1", german), + content, + MessageContent("content1", german), }); PluginCleaningData dirtyInfo(0xDEADBEEF, "cleaner", info, 2, 10, 30); diff --git a/src/tests/api/internals/metadata_list_test.h b/src/tests/api/internals/metadata_list_test.h index e93a2e76..6fd6900d 100644 --- a/src/tests/api/internals/metadata_list_test.h +++ b/src/tests/api/internals/metadata_list_test.h @@ -101,11 +101,13 @@ TEST_P(MetadataListTest, loadShouldLoadPluginMetadata) { std::insert_iterator>(names, begin(names)), &MetadataListTest::PluginMetadataToString); - EXPECT_EQ( - std::set({ - blankEsm, blankEsp, "Blank.+\\.esp", "Blank.+(Different)?.*\\.esp", - }), - names); + EXPECT_EQ(std::set({ + blankEsm, + blankEsp, + "Blank.+\\.esp", + "Blank.+(Different)?.*\\.esp", + }), + names); } TEST_P(MetadataListTest, loadShouldLoadBashTags) { @@ -182,11 +184,13 @@ TEST_P(MetadataListTest, saveShouldWriteTheLoadedMetadataToTheGivenFilePath) { end(result), std::insert_iterator>(names, begin(names)), &MetadataListTest::PluginMetadataToString); - EXPECT_EQ( - std::set({ - blankEsm, blankEsp, "Blank.+\\.esp", "Blank.+(Different)?.*\\.esp", - }), - names); + EXPECT_EQ(std::set({ + blankEsm, + blankEsp, + "Blank.+\\.esp", + "Blank.+(Different)?.*\\.esp", + }), + names); } TEST_P(MetadataListTest, clearShouldClearLoadedData) { diff --git a/src/tests/api/internals/plugin/plugin_sorter_test.h b/src/tests/api/internals/plugin/plugin_sorter_test.h index de96fd9c..9be048e4 100644 --- a/src/tests/api/internals/plugin/plugin_sorter_test.h +++ b/src/tests/api/internals/plugin/plugin_sorter_test.h @@ -34,9 +34,9 @@ namespace loot { namespace test { class PluginSorterTest : public CommonGameTestFixture { protected: - PluginSorterTest() : - game_(GetParam(), dataPath.parent_path(), localPath), - blankEslEsp("Blank.esl.esp") {} + PluginSorterTest() : + game_(GetParam(), dataPath.parent_path(), localPath), + blankEslEsp("Blank.esl.esp") {} void TearDown() { CommonGameTestFixture::TearDown(); @@ -46,7 +46,7 @@ protected: } } - void loadInstalledPlugins(Game& game_, bool headersOnly) { + void loadInstalledPlugins(Game &game_, bool headersOnly) { std::vector plugins({ masterFile, blankEsm, @@ -79,7 +79,9 @@ 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_CASE_P(, PluginSorterTest, ::testing::Values(GameType::tes4, GameType::fo4)); +INSTANTIATE_TEST_CASE_P(, + PluginSorterTest, + ::testing::Values(GameType::tes4, GameType::fo4)); TEST_P(PluginSorterTest, sortingWithNoLoadedPluginsShouldReturnAnEmptyList) { PluginSorter sorter; @@ -92,22 +94,30 @@ TEST_P(PluginSorterTest, lightMasterFlaggedEspFilesShouldNotBeTreatedAsMasters) { if (GetParam() == GameType::fo4 || GetParam() == GameType::tes5se) { ASSERT_NO_THROW( - boost::filesystem::copy(dataPath / blankEsl, dataPath / blankEslEsp)); + boost::filesystem::copy(dataPath / blankEsl, dataPath / blankEslEsp)); } ASSERT_NO_THROW(loadInstalledPlugins(game_, false)); - auto esp = PluginSortingData(*dynamic_cast(game_.GetPlugin(blankEsp).get()), PluginMetadata()); + auto esp = PluginSortingData( + *dynamic_cast(game_.GetPlugin(blankEsp).get()), + PluginMetadata()); EXPECT_FALSE(esp.IsMaster()); - auto master = PluginSortingData(*dynamic_cast(game_.GetPlugin(blankEsm).get()), PluginMetadata()); + auto master = PluginSortingData( + *dynamic_cast(game_.GetPlugin(blankEsm).get()), + PluginMetadata()); EXPECT_TRUE(master.IsMaster()); if (GetParam() == GameType::fo4 || GetParam() == GameType::tes5se) { - auto lightMaster = PluginSortingData(*dynamic_cast(game_.GetPlugin(blankEsl).get()), PluginMetadata()); + auto lightMaster = PluginSortingData( + *dynamic_cast(game_.GetPlugin(blankEsl).get()), + PluginMetadata()); EXPECT_TRUE(lightMaster.IsMaster()); - auto lightMasterEsp = PluginSortingData(*dynamic_cast(game_.GetPlugin(blankEslEsp).get()), PluginMetadata()); + auto lightMasterEsp = PluginSortingData( + *dynamic_cast(game_.GetPlugin(blankEslEsp).get()), + PluginMetadata()); EXPECT_FALSE(lightMasterEsp.IsMaster()); } } @@ -219,7 +229,8 @@ TEST_P(PluginSorterTest, ASSERT_NO_THROW(loadInstalledPlugins(game_, false)); PluginMetadata plugin(blankEsp); plugin.SetLoadAfterFiles({ - File(blankDifferentEsp), File(blankDifferentPluginDependentEsp), + File(blankDifferentEsp), + File(blankDifferentPluginDependentEsp), }); game_.GetDatabase()->SetPluginUserMetadata(plugin); @@ -251,7 +262,8 @@ TEST_P(PluginSorterTest, ASSERT_NO_THROW(loadInstalledPlugins(game_, false)); PluginMetadata plugin(blankEsp); plugin.SetRequirements({ - File(blankDifferentEsp), File(blankDifferentPluginDependentEsp), + File(blankDifferentEsp), + File(blankDifferentPluginDependentEsp), }); game_.GetDatabase()->SetPluginUserMetadata(plugin); diff --git a/src/tests/api/internals/plugin/plugin_test.h b/src/tests/api/internals/plugin/plugin_test.h index 06f41f30..ad297473 100644 --- a/src/tests/api/internals/plugin/plugin_test.h +++ b/src/tests/api/internals/plugin/plugin_test.h @@ -59,7 +59,7 @@ protected: if (GetParam() != GameType::fo4 && GetParam() != GameType::tes5se) { ASSERT_NO_THROW( - boost::filesystem::copy(dataPath / blankEsp, dataPath / blankEsl)); + boost::filesystem::copy(dataPath / blankEsp, dataPath / blankEsl)); } // Create dummy archive files.