Run clang-format

This commit is contained in:
Oliver Hamlet
2018-02-18 09:51:22 +00:00
parent ec946b5d0f
commit d4de7399f2
12 changed files with 93 additions and 59 deletions
+5 -2
View File
@@ -72,8 +72,11 @@ LOOT_API std::shared_ptr<GameInterface> 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);
+1 -1
View File
@@ -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;
+2 -1
View File
@@ -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(); }
+4 -4
View File
@@ -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_;
@@ -407,7 +407,10 @@ TEST_P(DatabaseInterfaceTest,
auto tags = db_->GetKnownBashTags();
std::set<std::string> 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<File> 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<std::string> 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<std::string> expectedTags({
"Actors.ACBS", "C.Climate",
"Actors.ACBS",
"C.Climate",
});
EXPECT_EQ(expectedTags, tags);
}
+11 -11
View File
@@ -149,17 +149,17 @@ TEST_P(GameInterfaceTest, sortPluginsShouldSucceedIfPassedValidArguments) {
handle_->GetDatabase()->LoadLists(masterlistPath.string(), ""));
std::vector<std::string> 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) {
+4 -3
View File
@@ -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;
@@ -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<Message>();
EXPECT_EQ(MessageContents({
MessageContent("content1"), MessageContent("content2", french),
MessageContent("content1"),
MessageContent("content2", french),
}),
message.GetContent());
}
@@ -113,7 +113,8 @@ TEST_P(
chooseInfoShouldSelectTheEnglishStringIfNoStringExistsForTheGivenLanguage) {
MessageContent content("content1", MessageContent::defaultLanguage);
std::vector<MessageContent> info({
content, MessageContent("content1", german),
content,
MessageContent("content1", german),
});
PluginCleaningData dirtyInfo(0xDEADBEEF, "cleaner", info, 2, 10, 30);
+14 -10
View File
@@ -101,11 +101,13 @@ TEST_P(MetadataListTest, loadShouldLoadPluginMetadata) {
std::insert_iterator<std::set<std::string>>(names, begin(names)),
&MetadataListTest::PluginMetadataToString);
EXPECT_EQ(
std::set<std::string>({
blankEsm, blankEsp, "Blank.+\\.esp", "Blank.+(Different)?.*\\.esp",
}),
names);
EXPECT_EQ(std::set<std::string>({
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<std::set<std::string>>(names, begin(names)),
&MetadataListTest::PluginMetadataToString);
EXPECT_EQ(
std::set<std::string>({
blankEsm, blankEsp, "Blank.+\\.esp", "Blank.+(Different)?.*\\.esp",
}),
names);
EXPECT_EQ(std::set<std::string>({
blankEsm,
blankEsp,
"Blank.+\\.esp",
"Blank.+(Different)?.*\\.esp",
}),
names);
}
TEST_P(MetadataListTest, clearShouldClearLoadedData) {
@@ -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<std::string> 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<const Plugin *>(game_.GetPlugin(blankEsp).get()), PluginMetadata());
auto esp = PluginSortingData(
*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEsp).get()),
PluginMetadata());
EXPECT_FALSE(esp.IsMaster());
auto master = PluginSortingData(*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEsm).get()), PluginMetadata());
auto master = PluginSortingData(
*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEsm).get()),
PluginMetadata());
EXPECT_TRUE(master.IsMaster());
if (GetParam() == GameType::fo4 || GetParam() == GameType::tes5se) {
auto lightMaster = PluginSortingData(*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEsl).get()), PluginMetadata());
auto lightMaster = PluginSortingData(
*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEsl).get()),
PluginMetadata());
EXPECT_TRUE(lightMaster.IsMaster());
auto lightMasterEsp = PluginSortingData(*dynamic_cast<const Plugin *>(game_.GetPlugin(blankEslEsp).get()), PluginMetadata());
auto lightMasterEsp = PluginSortingData(
*dynamic_cast<const Plugin *>(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);
+1 -1
View File
@@ -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.