Remove parameterisation from tests that don't need it

This commit is contained in:
Oliver Hamlet
2025-03-05 18:30:41 +00:00
parent 59901d2318
commit 1d36684f7d
16 changed files with 234 additions and 238 deletions
@@ -32,9 +32,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class ApiGameOperationsTest : public CommonGameTestFixture {
class ApiGameOperationsTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
ApiGameOperationsTest() :
CommonGameTestFixture(GetParam()),
handle_(nullptr),
masterlistPath(localPath / "masterlist.yaml"),
noteMessage(
@@ -32,9 +32,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class CreateGameHandleTest : public CommonGameTestFixture {
class CreateGameHandleTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
CreateGameHandleTest() :
CommonGameTestFixture(GetParam()),
handle_(nullptr),
gamePathSymlink(gamePath.string() + ".symlink"),
localPathSymlink(localPath.string() + ".symlink"),
+12 -17
View File
@@ -34,7 +34,8 @@ namespace test {
class GameCacheTest : public CommonGameTestFixture {
protected:
GameCacheTest() :
game_(GetParam(), gamePath, localPath),
CommonGameTestFixture(GameType::tes5),
game_(GameType::tes5, gamePath, localPath),
condition("Condition"),
conditionLowercase("condition") {}
@@ -45,19 +46,13 @@ protected:
const std::string conditionLowercase;
};
// 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.
// Just test with one game_ because if it works for one it will work for them
// all.
INSTANTIATE_TEST_SUITE_P(, GameCacheTest, ::testing::Values(GameType::tes5));
TEST_P(GameCacheTest, addingAPluginThatDoesNotExistShouldSucceed) {
TEST_F(GameCacheTest, addingAPluginThatDoesNotExistShouldSucceed) {
cache_.AddPlugin(
Plugin(game_.GetType(), GameCache(), game_.DataPath() / blankEsm, true));
EXPECT_EQ(blankEsm, cache_.GetPlugin(blankEsm)->GetName());
}
TEST_P(GameCacheTest,
TEST_F(GameCacheTest,
addingAPluginThatIsAlreadyCachedShouldOverwriteExistingEntry) {
cache_.AddPlugin(
Plugin(game_.GetType(), GameCache(), game_.DataPath() / blankEsm, true));
@@ -68,22 +63,22 @@ TEST_P(GameCacheTest,
EXPECT_EQ(blankEsmCrc, cache_.GetPlugin(blankEsm)->GetCRC().value());
}
TEST_P(GameCacheTest, gettingAPluginThatIsNotCachedShouldReturnANullPointer) {
TEST_F(GameCacheTest, gettingAPluginThatIsNotCachedShouldReturnANullPointer) {
EXPECT_FALSE(cache_.GetPlugin(blankEsm));
}
TEST_P(GameCacheTest, gettingAPluginShouldBeCaseInsensitive) {
TEST_F(GameCacheTest, gettingAPluginShouldBeCaseInsensitive) {
cache_.AddPlugin(
Plugin(game_.GetType(), GameCache(), game_.DataPath() / blankEsm, true));
EXPECT_EQ(blankEsm, cache_.GetPlugin(blankEsm)->GetName());
}
TEST_P(GameCacheTest,
TEST_F(GameCacheTest,
gettingPluginsShouldReturnAnEmptySetIfNoPluginsHaveBeenCached) {
EXPECT_TRUE(cache_.GetPlugins().empty());
}
TEST_P(GameCacheTest,
TEST_F(GameCacheTest,
gettingPluginsShouldReturnASetOfCachedPluginsIfPluginsHaveBeenCached) {
cache_.AddPlugin(
Plugin(game_.GetType(), GameCache(), game_.DataPath() / blankEsm, true));
@@ -96,12 +91,12 @@ TEST_P(GameCacheTest,
EXPECT_FALSE(cache_.GetPlugins().empty());
}
TEST_P(GameCacheTest,
TEST_F(GameCacheTest,
gettingArchivePathsShouldReturnAnEmptySetIfNoPathsHaveBeenCached) {
EXPECT_TRUE(cache_.GetArchivePaths().empty());
}
TEST_P(GameCacheTest,
TEST_F(GameCacheTest,
gettingArchivePathsShouldReturnASetOfPathsIfPathsHaveBeenCached) {
cache_.CacheArchivePaths({game_.DataPath() / blankEsm,
game_.DataPath() / blankMasterDependentEsm});
@@ -114,11 +109,11 @@ TEST_P(GameCacheTest,
EXPECT_EQ(expected, cache_.GetArchivePaths());
}
TEST_P(GameCacheTest, clearingCachedPluginsShouldNotThrowIfNoPluginsAreCached) {
TEST_F(GameCacheTest, clearingCachedPluginsShouldNotThrowIfNoPluginsAreCached) {
EXPECT_NO_THROW(cache_.ClearCachedPlugins());
}
TEST_P(GameCacheTest, clearingCachedPluginsShouldClearAnyCachedPlugins) {
TEST_F(GameCacheTest, clearingCachedPluginsShouldClearAnyCachedPlugins) {
cache_.AddPlugin(
Plugin(game_.GetType(), GameCache(), game_.DataPath() / blankEsm, true));
cache_.ClearCachedPlugins();
+7 -5
View File
@@ -31,9 +31,12 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class GameTest : public CommonGameTestFixture {
class GameTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
GameTest() : blankArchive("Blank" + GetArchiveFileExtension(GetParam())) {
GameTest() :
CommonGameTestFixture(GetParam()),
blankArchive("Blank" + GetArchiveFileExtension(GetParam())) {
touch(dataPath / blankArchive);
}
@@ -221,9 +224,8 @@ TEST_P(
}
}
TEST_P(
GameTest,
loadPluginsWithHeadersOnlyTrueShouldLoadTheHeadersOfGivenPlugins) {
TEST_P(GameTest,
loadPluginsWithHeadersOnlyTrueShouldLoadTheHeadersOfGivenPlugins) {
Game game = Game(GetParam(), gamePath, localPath);
EXPECT_NO_THROW(loadInstalledPlugins(game, true));
@@ -30,9 +30,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class LoadOrderHandlerTest : public CommonGameTestFixture {
class LoadOrderHandlerTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
LoadOrderHandlerTest() :
CommonGameTestFixture(GetParam()),
loadOrderToSet_({
masterFile,
blankEsm,
+6 -9
View File
@@ -31,19 +31,16 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class GetCrc32Test : public CommonGameTestFixture {};
class GetCrc32Test : public CommonGameTestFixture {
protected:
GetCrc32Test() : CommonGameTestFixture(GameType::tes5) {}
};
// 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.
// Just test with one game because if it works for one it will work for them
// all.
INSTANTIATE_TEST_SUITE_P(, GetCrc32Test, ::testing::Values(GameType::tes5));
TEST_P(GetCrc32Test, gettingTheCrcOfAMissingFileShouldThrow) {
TEST_F(GetCrc32Test, gettingTheCrcOfAMissingFileShouldThrow) {
EXPECT_THROW(GetCrc32(dataPath / missingEsp), FileAccessError);
}
TEST_P(GetCrc32Test, gettingTheCrcOfAFileShouldReturnTheCorrectValue) {
TEST_F(GetCrc32Test, gettingTheCrcOfAFileShouldReturnTheCorrectValue) {
EXPECT_EQ(blankEsmCrc, GetCrc32(dataPath / blankEsm));
}
}
@@ -31,9 +31,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class ConditionEvaluatorTest : public CommonGameTestFixture {
class ConditionEvaluatorTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
ConditionEvaluatorTest() :
CommonGameTestFixture(GetParam()),
info_(std::vector<MessageContent>({
MessageContent("info"),
})),
@@ -30,8 +30,10 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class ConditionalMetadataTest : public CommonGameTestFixture {
class ConditionalMetadataTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
ConditionalMetadataTest() : CommonGameTestFixture(GetParam()) {}
ConditionalMetadata conditionalMetadata_;
};
+45 -48
View File
@@ -34,20 +34,17 @@ namespace loot {
namespace test {
class MessageTest : public CommonGameTestFixture {
protected:
MessageTest() : CommonGameTestFixture(GameType::tes4) {}
typedef std::vector<MessageContent> MessageContents;
};
// 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(, MessageTest, ::testing::Values(GameType::tes4));
TEST_P(MessageTest, defaultConstructorShouldCreateNoteWithNoContent) {
TEST_F(MessageTest, defaultConstructorShouldCreateNoteWithNoContent) {
Message message;
EXPECT_EQ(MessageType::say, message.GetType());
EXPECT_EQ(MessageContents(), message.GetContent());
}
TEST_P(MessageTest,
TEST_F(MessageTest,
scalarContentConstructorShouldCreateAMessageWithASingleContentString) {
MessageContent content = MessageContent("content1");
Message message(MessageType::warn, content.GetText(), "condition1");
@@ -57,7 +54,7 @@ TEST_P(MessageTest,
EXPECT_EQ("condition1", message.GetCondition());
}
TEST_P(MessageTest,
TEST_F(MessageTest,
vectorContentConstructorShouldCreateAMessageWithGivenContentStrings) {
MessageContents contents({
MessageContent("content1"),
@@ -70,7 +67,7 @@ TEST_P(MessageTest,
EXPECT_EQ("condition1", message.GetCondition());
}
TEST_P(
TEST_F(
MessageTest,
vectorContentConstructorShouldThrowIfMultipleContentStringsAreGivenAndNoneAreEnglish) {
MessageContents contents({
@@ -81,7 +78,7 @@ TEST_P(
std::invalid_argument);
}
TEST_P(MessageTest, equalityShouldRequireEqualMessageTypes) {
TEST_F(MessageTest, equalityShouldRequireEqualMessageTypes) {
Message message1(MessageType::say, "content");
Message message2(MessageType::say, "content");
@@ -93,7 +90,7 @@ TEST_P(MessageTest, equalityShouldRequireEqualMessageTypes) {
EXPECT_FALSE(message1 == message2);
}
TEST_P(MessageTest, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
TEST_F(MessageTest, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
Message message1(MessageType::say, "content", "condition");
Message message2(MessageType::say, "content", "condition");
@@ -110,7 +107,7 @@ TEST_P(MessageTest, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
EXPECT_FALSE(message1 == message2);
}
TEST_P(MessageTest, equalityShouldRequireEqualContent) {
TEST_F(MessageTest, equalityShouldRequireEqualContent) {
Message message1(MessageType::say, "content");
Message message2(MessageType::say, "content");
@@ -122,7 +119,7 @@ TEST_P(MessageTest, equalityShouldRequireEqualContent) {
EXPECT_FALSE(message1 == message2);
}
TEST_P(MessageTest, inequalityShouldBeTheInverseOfEquality) {
TEST_F(MessageTest, inequalityShouldBeTheInverseOfEquality) {
Message message1(MessageType::say, "content");
Message message2(MessageType::say, "content");
@@ -159,7 +156,7 @@ TEST_P(MessageTest, inequalityShouldBeTheInverseOfEquality) {
EXPECT_TRUE(message1 != message2);
}
TEST_P(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
TEST_F(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
Message message1(MessageType::say, "content");
Message message2(MessageType::say, "content");
@@ -173,7 +170,7 @@ TEST_P(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
EXPECT_FALSE(message2 < message1);
}
TEST_P(MessageTest, lessThanOperatorShouldCompareContent) {
TEST_F(MessageTest, lessThanOperatorShouldCompareContent) {
Message message1(MessageType::say, "content");
Message message2(MessageType::say, "content");
@@ -187,7 +184,7 @@ TEST_P(MessageTest, lessThanOperatorShouldCompareContent) {
EXPECT_FALSE(message2 < message1);
}
TEST_P(
TEST_F(
MessageTest,
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForConditions) {
Message message1(MessageType::say, "content", "condition");
@@ -209,7 +206,7 @@ TEST_P(
EXPECT_FALSE(message2 < message1);
}
TEST_P(
TEST_F(
MessageTest,
greaterThanOperatorShouldReturnTrueIfTheSecondMessageIsLessThanTheFirst) {
Message message1(MessageType::say, "content");
@@ -255,7 +252,7 @@ TEST_P(
EXPECT_TRUE(message2 > message1);
}
TEST_P(
TEST_F(
MessageTest,
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstMessageIsNotGreaterThanTheSecond) {
Message message1(MessageType::say, "content");
@@ -301,7 +298,7 @@ TEST_P(
EXPECT_FALSE(message2 <= message1);
}
TEST_P(
TEST_F(
MessageTest,
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstMessageIsNotLessThanTheSecond) {
Message message1(MessageType::say, "content");
@@ -347,7 +344,7 @@ TEST_P(
EXPECT_TRUE(message2 >= message1);
}
TEST_P(MessageTest, emittingAsYamlShouldOutputNoteMessageTypeCorrectly) {
TEST_F(MessageTest, emittingAsYamlShouldOutputNoteMessageTypeCorrectly) {
Message message(MessageType::say, "content1");
YAML::Emitter emitter;
emitter << message;
@@ -358,7 +355,7 @@ TEST_P(MessageTest, emittingAsYamlShouldOutputNoteMessageTypeCorrectly) {
emitter.c_str());
}
TEST_P(MessageTest, emittingAsYamlShouldOutputWarnMessageTypeCorrectly) {
TEST_F(MessageTest, emittingAsYamlShouldOutputWarnMessageTypeCorrectly) {
Message message(MessageType::warn, "content1");
YAML::Emitter emitter;
emitter << message;
@@ -369,7 +366,7 @@ TEST_P(MessageTest, emittingAsYamlShouldOutputWarnMessageTypeCorrectly) {
emitter.c_str());
}
TEST_P(MessageTest, emittingAsYamlShouldOutputErrorMessageTypeCorrectly) {
TEST_F(MessageTest, emittingAsYamlShouldOutputErrorMessageTypeCorrectly) {
Message message(MessageType::error, "content1");
YAML::Emitter emitter;
emitter << message;
@@ -380,7 +377,7 @@ TEST_P(MessageTest, emittingAsYamlShouldOutputErrorMessageTypeCorrectly) {
emitter.c_str());
}
TEST_P(MessageTest, emittingAsYamlShouldOutputConditionIfItIsNotEmpty) {
TEST_F(MessageTest, emittingAsYamlShouldOutputConditionIfItIsNotEmpty) {
Message message(MessageType::say, "content1", "condition1");
YAML::Emitter emitter;
emitter << message;
@@ -392,7 +389,7 @@ TEST_P(MessageTest, emittingAsYamlShouldOutputConditionIfItIsNotEmpty) {
emitter.c_str());
}
TEST_P(MessageTest, emittingAsYamlShouldOutputMultipleContentStringsAsAList) {
TEST_F(MessageTest, emittingAsYamlShouldOutputMultipleContentStringsAsAList) {
Message message(MessageType::say,
MessageContents({MessageContent("content1"),
MessageContent("content2", french)}));
@@ -409,7 +406,7 @@ TEST_P(MessageTest, emittingAsYamlShouldOutputMultipleContentStringsAsAList) {
emitter.c_str());
}
TEST_P(MessageTest, encodingAsYamlShouldStoreNoteMessageTypeCorrectly) {
TEST_F(MessageTest, encodingAsYamlShouldStoreNoteMessageTypeCorrectly) {
Message message(MessageType::say, "content1");
YAML::Node node;
node = message;
@@ -417,7 +414,7 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreNoteMessageTypeCorrectly) {
EXPECT_EQ("say", node["type"].as<std::string>());
}
TEST_P(MessageTest, encodingAsYamlShouldStoreWarningMessageTypeCorrectly) {
TEST_F(MessageTest, encodingAsYamlShouldStoreWarningMessageTypeCorrectly) {
Message message(MessageType::warn, "content1");
YAML::Node node;
node = message;
@@ -425,7 +422,7 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreWarningMessageTypeCorrectly) {
EXPECT_EQ("warn", node["type"].as<std::string>());
}
TEST_P(MessageTest, encodingAsYamlShouldStoreErrorMessageTypeCorrectly) {
TEST_F(MessageTest, encodingAsYamlShouldStoreErrorMessageTypeCorrectly) {
Message message(MessageType::error, "content1");
YAML::Node node;
node = message;
@@ -433,7 +430,7 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreErrorMessageTypeCorrectly) {
EXPECT_EQ("error", node["type"].as<std::string>());
}
TEST_P(MessageTest, encodingAsYamlShouldOmitConditionFieldIfItIsEmpty) {
TEST_F(MessageTest, encodingAsYamlShouldOmitConditionFieldIfItIsEmpty) {
Message message(MessageType::say, "content1");
YAML::Node node;
node = message;
@@ -441,7 +438,7 @@ TEST_P(MessageTest, encodingAsYamlShouldOmitConditionFieldIfItIsEmpty) {
EXPECT_FALSE(node["condition"]);
}
TEST_P(MessageTest, encodingAsYamlShouldStoreConditionFieldIfItIsNotEmpty) {
TEST_F(MessageTest, encodingAsYamlShouldStoreConditionFieldIfItIsNotEmpty) {
Message message(MessageType::say, "content1", "condition1");
YAML::Node node;
node = message;
@@ -449,7 +446,7 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreConditionFieldIfItIsNotEmpty) {
EXPECT_EQ("condition1", node["condition"].as<std::string>());
}
TEST_P(MessageTest, encodingAsYamlShouldStoreASingleContentStringInAVector) {
TEST_F(MessageTest, encodingAsYamlShouldStoreASingleContentStringInAVector) {
Message message(MessageType::say, "content1");
YAML::Node node;
node = message;
@@ -457,7 +454,7 @@ TEST_P(MessageTest, encodingAsYamlShouldStoreASingleContentStringInAVector) {
EXPECT_EQ(message.GetContent(), node["content"].as<MessageContents>());
}
TEST_P(MessageTest, encodingAsYamlShouldMultipleContentStringsInAVector) {
TEST_F(MessageTest, encodingAsYamlShouldMultipleContentStringsInAVector) {
MessageContents contents({
MessageContent("content1"),
MessageContent("content2", french),
@@ -469,7 +466,7 @@ TEST_P(MessageTest, encodingAsYamlShouldMultipleContentStringsInAVector) {
EXPECT_EQ(contents, node["content"].as<MessageContents>());
}
TEST_P(MessageTest, decodingFromYamlShouldSetNoteTypeCorrectly) {
TEST_F(MessageTest, decodingFromYamlShouldSetNoteTypeCorrectly) {
YAML::Node node = YAML::Load(
"type: say\n"
"content: content1");
@@ -478,7 +475,7 @@ TEST_P(MessageTest, decodingFromYamlShouldSetNoteTypeCorrectly) {
EXPECT_EQ(MessageType::say, message.GetType());
}
TEST_P(MessageTest, decodingFromYamlShouldSetWarningTypeCorrectly) {
TEST_F(MessageTest, decodingFromYamlShouldSetWarningTypeCorrectly) {
YAML::Node node = YAML::Load(
"type: warn\n"
"content: content1");
@@ -487,7 +484,7 @@ TEST_P(MessageTest, decodingFromYamlShouldSetWarningTypeCorrectly) {
EXPECT_EQ(MessageType::warn, message.GetType());
}
TEST_P(MessageTest, decodingFromYamlShouldSetErrorTypeCorrectly) {
TEST_F(MessageTest, decodingFromYamlShouldSetErrorTypeCorrectly) {
YAML::Node node = YAML::Load(
"type: error\n"
"content: content1");
@@ -496,7 +493,7 @@ TEST_P(MessageTest, decodingFromYamlShouldSetErrorTypeCorrectly) {
EXPECT_EQ(MessageType::error, message.GetType());
}
TEST_P(MessageTest, decodingFromYamlShouldHandleAnUnrecognisedTypeAsANote) {
TEST_F(MessageTest, decodingFromYamlShouldHandleAnUnrecognisedTypeAsANote) {
YAML::Node node = YAML::Load(
"type: invalid\n"
"content: content1");
@@ -505,7 +502,7 @@ TEST_P(MessageTest, decodingFromYamlShouldHandleAnUnrecognisedTypeAsANote) {
EXPECT_EQ(MessageType::say, message.GetType());
}
TEST_P(MessageTest,
TEST_F(MessageTest,
decodingFromYamlShouldLeaveTheConditionEmptyIfNoneIsPresent) {
YAML::Node node = YAML::Load(
"type: say\n"
@@ -515,7 +512,7 @@ TEST_P(MessageTest,
EXPECT_TRUE(message.GetCondition().empty());
}
TEST_P(MessageTest, decodingFromYamlShouldStoreANonEmptyConditionField) {
TEST_F(MessageTest, decodingFromYamlShouldStoreANonEmptyConditionField) {
YAML::Node node = YAML::Load(
"type: say\n"
"content: content1\n"
@@ -525,7 +522,7 @@ TEST_P(MessageTest, decodingFromYamlShouldStoreANonEmptyConditionField) {
EXPECT_EQ("file(\"Foo.esp\")", message.GetCondition());
}
TEST_P(MessageTest, decodingFromYamlShouldStoreAScalarContentValueCorrectly) {
TEST_F(MessageTest, decodingFromYamlShouldStoreAScalarContentValueCorrectly) {
YAML::Node node = YAML::Load(
"type: say\n"
"content: content1\n");
@@ -535,7 +532,7 @@ TEST_P(MessageTest, decodingFromYamlShouldStoreAScalarContentValueCorrectly) {
EXPECT_EQ(expectedContent, message.GetContent());
}
TEST_P(MessageTest, decodingFromYamlShouldStoreAListOfContentStringsCorrectly) {
TEST_F(MessageTest, decodingFromYamlShouldStoreAListOfContentStringsCorrectly) {
YAML::Node node = YAML::Load(
"type: say\n"
"content:\n"
@@ -552,7 +549,7 @@ TEST_P(MessageTest, decodingFromYamlShouldStoreAListOfContentStringsCorrectly) {
message.GetContent());
}
TEST_P(MessageTest,
TEST_F(MessageTest,
decodingFromYamlShouldNotThrowIfTheOnlyContentStringIsNotEnglish) {
YAML::Node node = YAML::Load(
"type: say\n"
@@ -563,7 +560,7 @@ TEST_P(MessageTest,
EXPECT_NO_THROW(Message message = node.as<Message>());
}
TEST_P(
TEST_F(
MessageTest,
decodingFromYamlShouldThrowIfMultipleContentStringsAreGivenAndNoneAreEnglish) {
YAML::Node node = YAML::Load(
@@ -577,7 +574,7 @@ TEST_P(
EXPECT_THROW(node.as<Message>(), YAML::RepresentationException);
}
TEST_P(
TEST_F(
MessageTest,
decodingFromYamlShouldApplySubstitutionsWhenThereIsOnlyOneContentString) {
YAML::Node node = YAML::Load(
@@ -591,7 +588,7 @@ TEST_P(
message.GetContent());
}
TEST_P(MessageTest,
TEST_F(MessageTest,
decodingFromYamlShouldApplySubstitutionsToAllContentStrings) {
YAML::Node node = YAML::Load(
"type: say\n"
@@ -611,7 +608,7 @@ TEST_P(MessageTest,
message.GetContent());
}
TEST_P(
TEST_F(
MessageTest,
decodingFromYamlShouldThrowIfTheContentStringExpectsMoreSubstitutionsThanExist) {
YAML::Node node = YAML::Load(
@@ -625,7 +622,7 @@ TEST_P(
// Don't throw because no subs are given, so none are expected in the content
// string.
TEST_P(MessageTest,
TEST_F(MessageTest,
decodingFromYamlShouldIgnoreSubstitutionSyntaxIfNoSubstitutionsExist) {
YAML::Node node = YAML::Load(
"type: say\n"
@@ -636,7 +633,7 @@ TEST_P(MessageTest,
message.GetContent());
}
TEST_P(MessageTest, decodingFromYamlShouldAcceptPercentagePlaceholderSyntax) {
TEST_F(MessageTest, decodingFromYamlShouldAcceptPercentagePlaceholderSyntax) {
YAML::Node node = YAML::Load(
"type: say\n"
"content: content %1% %2% %3% %4% %5% %6% %7% %8% %9% %10% %11%\n"
@@ -658,7 +655,7 @@ TEST_P(MessageTest, decodingFromYamlShouldAcceptPercentagePlaceholderSyntax) {
EXPECT_EQ("content a b c d e f g h i j k", message.GetContent()[0].GetText());
}
TEST_P(MessageTest, decodingFromYamlShouldThrowIfAnInvalidConditionIsGiven) {
TEST_F(MessageTest, decodingFromYamlShouldThrowIfAnInvalidConditionIsGiven) {
YAML::Node node = YAML::Load(
"type: say\n"
"content: content1\n"
@@ -667,13 +664,13 @@ TEST_P(MessageTest, decodingFromYamlShouldThrowIfAnInvalidConditionIsGiven) {
EXPECT_THROW(node.as<Message>(), YAML::RepresentationException);
}
TEST_P(MessageTest, decodingFromYamlShouldThrowIfAScalarIsGiven) {
TEST_F(MessageTest, decodingFromYamlShouldThrowIfAScalarIsGiven) {
YAML::Node node = YAML::Load("scalar");
EXPECT_THROW(node.as<Message>(), YAML::RepresentationException);
}
TEST_P(MessageTest, decodingFromYamlShouldThrowIfAListIsGiven) {
TEST_F(MessageTest, decodingFromYamlShouldThrowIfAListIsGiven) {
YAML::Node node = YAML::Load("[0, 1, 2]");
EXPECT_THROW(node.as<Message>(), YAML::RepresentationException);
@@ -35,6 +35,7 @@ namespace test {
class PluginCleaningDataTest : public CommonGameTestFixture {
protected:
PluginCleaningDataTest() :
CommonGameTestFixture(GameType::tes4),
info_(std::vector<MessageContent>({
MessageContent("info"),
})) {}
@@ -42,13 +43,7 @@ protected:
const std::vector<MessageContent> info_;
};
// 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(,
PluginCleaningDataTest,
::testing::Values(GameType::tes4));
TEST_P(PluginCleaningDataTest,
TEST_F(PluginCleaningDataTest,
defaultConstructorShouldLeaveAllCountsAtZeroAndTheUtilityStringEmpty) {
PluginCleaningData info;
EXPECT_EQ(0u, info.GetCRC());
@@ -59,7 +54,7 @@ TEST_P(PluginCleaningDataTest,
EXPECT_TRUE(info.GetDetail().empty());
}
TEST_P(PluginCleaningDataTest, contentConstructorShouldStoreAllGivenData) {
TEST_F(PluginCleaningDataTest, contentConstructorShouldStoreAllGivenData) {
PluginCleaningData info(0x12345678, "cleaner", info_, 2, 10, 30);
EXPECT_EQ(0x12345678u, info.GetCRC());
EXPECT_EQ(2u, info.GetITMCount());
@@ -69,7 +64,7 @@ TEST_P(PluginCleaningDataTest, contentConstructorShouldStoreAllGivenData) {
EXPECT_EQ(info_, info.GetDetail());
}
TEST_P(PluginCleaningDataTest, equalityShouldCheckEqualityOfAllFields) {
TEST_F(PluginCleaningDataTest, equalityShouldCheckEqualityOfAllFields) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
EXPECT_TRUE(info1 == info2);
@@ -104,7 +99,7 @@ TEST_P(PluginCleaningDataTest, equalityShouldCheckEqualityOfAllFields) {
EXPECT_FALSE(info1 == info2);
}
TEST_P(PluginCleaningDataTest, inequalityShouldBeTheInverseOfEquality) {
TEST_F(PluginCleaningDataTest, inequalityShouldBeTheInverseOfEquality) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
EXPECT_FALSE(info1 != info2);
@@ -139,7 +134,7 @@ TEST_P(PluginCleaningDataTest, inequalityShouldBeTheInverseOfEquality) {
EXPECT_TRUE(info1 != info2);
}
TEST_P(PluginCleaningDataTest, lessThanOperatorShouldCompareAllFields) {
TEST_F(PluginCleaningDataTest, lessThanOperatorShouldCompareAllFields) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
EXPECT_FALSE(info1 < info2);
@@ -182,7 +177,7 @@ TEST_P(PluginCleaningDataTest, lessThanOperatorShouldCompareAllFields) {
EXPECT_FALSE(info2 < info1);
}
TEST_P(
TEST_F(
PluginCleaningDataTest,
greaterThanOperatorShouldReturnTrueIfTheSecondPluginCleaningDataIsLessThanTheFirst) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
@@ -227,7 +222,7 @@ TEST_P(
EXPECT_TRUE(info2 > info1);
}
TEST_P(
TEST_F(
PluginCleaningDataTest,
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstPluginCleaningDataIsNotGreaterThanTheSecond) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
@@ -272,7 +267,7 @@ TEST_P(
EXPECT_FALSE(info2 < info1);
}
TEST_P(
TEST_F(
PluginCleaningDataTest,
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstPluginCleaningDataIsNotLessThanTheSecond) {
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
@@ -317,7 +312,7 @@ TEST_P(
EXPECT_TRUE(info2 > info1);
}
TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOutputAllNonZeroCounts) {
TEST_F(PluginCleaningDataTest, emittingAsYamlShouldOutputAllNonZeroCounts) {
PluginCleaningData info(0x12345678, "cleaner", info_, 2, 10, 30);
YAML::Emitter emitter;
emitter << info;
@@ -328,7 +323,7 @@ TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOutputAllNonZeroCounts) {
emitter.c_str());
}
TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOmitAllZeroCounts) {
TEST_F(PluginCleaningDataTest, emittingAsYamlShouldOmitAllZeroCounts) {
PluginCleaningData info(0x12345678, "cleaner", info_, 0, 0, 0);
YAML::Emitter emitter;
emitter << info;
@@ -337,7 +332,7 @@ TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOmitAllZeroCounts) {
emitter.c_str());
}
TEST_P(PluginCleaningDataTest, encodingAsYamlShouldOmitAllZeroCountFields) {
TEST_F(PluginCleaningDataTest, encodingAsYamlShouldOmitAllZeroCountFields) {
PluginCleaningData info(0x12345678, "cleaner", info_, 0, 0, 0);
YAML::Node node;
node = info;
@@ -350,7 +345,7 @@ TEST_P(PluginCleaningDataTest, encodingAsYamlShouldOmitAllZeroCountFields) {
EXPECT_FALSE(node["nav"]);
}
TEST_P(PluginCleaningDataTest,
TEST_F(PluginCleaningDataTest,
encodingAsYamlShouldOutputAllNonZeroCountFields) {
PluginCleaningData info(0x12345678, "cleaner", info_, 2, 10, 30);
YAML::Node node;
@@ -364,7 +359,7 @@ TEST_P(PluginCleaningDataTest,
EXPECT_EQ(30u, node["nav"].as<unsigned int>());
}
TEST_P(PluginCleaningDataTest,
TEST_F(PluginCleaningDataTest,
decodingFromYamlShouldLeaveMissingFieldsWithZeroValues) {
YAML::Node node = YAML::Load("{crc: 0x12345678, util: cleaner}");
PluginCleaningData info = node.as<PluginCleaningData>();
@@ -377,7 +372,7 @@ TEST_P(PluginCleaningDataTest,
EXPECT_EQ("cleaner", info.GetCleaningUtility());
}
TEST_P(PluginCleaningDataTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
TEST_F(PluginCleaningDataTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
YAML::Node node = YAML::Load(
"{crc: 0x12345678, util: cleaner, detail: info, itm: 2, udr: 10, nav: "
"30}");
@@ -391,7 +386,7 @@ TEST_P(PluginCleaningDataTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
EXPECT_EQ("cleaner", info.GetCleaningUtility());
}
TEST_P(PluginCleaningDataTest,
TEST_F(PluginCleaningDataTest,
decodingFromYamlShouldNotThrowIfTheOnlyDetailStringIsNotEnglish) {
YAML::Node node = YAML::Load(
"crc: 0x12345678\n"
@@ -403,7 +398,7 @@ TEST_P(PluginCleaningDataTest,
EXPECT_NO_THROW(node.as<PluginCleaningData>());
}
TEST_P(
TEST_F(
PluginCleaningDataTest,
decodingFromYamlShouldThrowIfMultipleDetailStringsAreGivenAndNoneAreEnglish) {
YAML::Node node = YAML::Load(
@@ -418,13 +413,13 @@ TEST_P(
EXPECT_THROW(node.as<PluginCleaningData>(), YAML::RepresentationException);
}
TEST_P(PluginCleaningDataTest, decodingFromYamlScalarShouldThrow) {
TEST_F(PluginCleaningDataTest, decodingFromYamlScalarShouldThrow) {
YAML::Node node = YAML::Load("scalar");
EXPECT_THROW(node.as<PluginCleaningData>(), YAML::RepresentationException);
}
TEST_P(PluginCleaningDataTest, decodingFromYamlListShouldThrow) {
TEST_F(PluginCleaningDataTest, decodingFromYamlListShouldThrow) {
YAML::Node node = YAML::Load("[0, 1, 2]");
EXPECT_THROW(node.as<PluginCleaningData>(), YAML::RepresentationException);
File diff suppressed because it is too large Load Diff
+19 -22
View File
@@ -33,6 +33,7 @@ namespace test {
class MetadataListTest : public CommonGameTestFixture {
protected:
MetadataListTest() :
CommonGameTestFixture(GameType::tes4),
metadataPath(metadataFilesPath / "masterlist.yaml"),
savedMetadataPath(metadataFilesPath / "saved.masterlist.yaml"),
missingMetadataPath(metadataFilesPath / "missing-metadata.yaml") {}
@@ -104,11 +105,7 @@ plugins:
const std::filesystem::path missingMetadataPath;
};
// 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(, MetadataListTest, ::testing::Values(GameType::tes4));
TEST_P(MetadataListTest, loadShouldLoadGlobalMessages) {
TEST_F(MetadataListTest, loadShouldLoadGlobalMessages) {
MetadataList metadataList;
EXPECT_NO_THROW(metadataList.Load(metadataPath));
@@ -118,7 +115,7 @@ TEST_P(MetadataListTest, loadShouldLoadGlobalMessages) {
metadataList.Messages());
}
TEST_P(MetadataListTest, loadShouldLoadPluginMetadata) {
TEST_F(MetadataListTest, loadShouldLoadPluginMetadata) {
MetadataList metadataList;
EXPECT_NO_THROW(metadataList.Load(metadataPath));
@@ -142,7 +139,7 @@ TEST_P(MetadataListTest, loadShouldLoadPluginMetadata) {
names);
}
TEST_P(MetadataListTest, loadShouldLoadBashTags) {
TEST_F(MetadataListTest, loadShouldLoadBashTags) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -150,7 +147,7 @@ TEST_P(MetadataListTest, loadShouldLoadBashTags) {
metadataList.BashTags());
}
TEST_P(MetadataListTest, loadShouldLoadGroups) {
TEST_F(MetadataListTest, loadShouldLoadGroups) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -168,7 +165,7 @@ TEST_P(MetadataListTest, loadShouldLoadGroups) {
EXPECT_EQ(std::vector<std::string>({"default"}), groups[2].GetAfterGroups());
}
TEST_P(MetadataListTest, loadYamlParsingShouldSupportMergeKeys) {
TEST_F(MetadataListTest, loadYamlParsingShouldSupportMergeKeys) {
using std::endl;
std::ofstream out(metadataPath);
@@ -194,7 +191,7 @@ TEST_P(MetadataListTest, loadYamlParsingShouldSupportMergeKeys) {
EXPECT_EQ(std::vector<std::string>({"earliest"}), groups[0].GetAfterGroups());
}
TEST_P(MetadataListTest, loadShouldThrowIfAnInvalidMetadataFileIsGiven) {
TEST_F(MetadataListTest, loadShouldThrowIfAnInvalidMetadataFileIsGiven) {
MetadataList metadataList;
std::ofstream out(metadataPath);
@@ -237,7 +234,7 @@ plugins:
EXPECT_THROW(metadataList.Load(metadataPath), FileAccessError);
}
TEST_P(MetadataListTest,
TEST_F(MetadataListTest,
loadShouldClearExistingDataIfAnInvalidMetadataFileIsGiven) {
MetadataList metadataList;
@@ -252,7 +249,7 @@ TEST_P(MetadataListTest,
EXPECT_TRUE(metadataList.BashTags().empty());
}
TEST_P(MetadataListTest,
TEST_F(MetadataListTest,
loadShouldClearExistingDataIfAMissingMetadataFileIsGiven) {
MetadataList metadataList;
@@ -267,7 +264,7 @@ TEST_P(MetadataListTest,
EXPECT_TRUE(metadataList.BashTags().empty());
}
TEST_P(
TEST_F(
MetadataListTest,
loadWithPreludeShouldReplaceThePreludeInTheFirstFileWithTheContentOfTheSecond) {
using std::endl;
@@ -299,7 +296,7 @@ TEST_P(
EXPECT_EQ("Loaded from prelude", messages[0].GetContent()[0].GetText());
}
TEST_P(MetadataListTest, saveShouldWriteTheLoadedMetadataToTheGivenFilePath) {
TEST_F(MetadataListTest, saveShouldWriteTheLoadedMetadataToTheGivenFilePath) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -342,7 +339,7 @@ TEST_P(MetadataListTest, saveShouldWriteTheLoadedMetadataToTheGivenFilePath) {
names);
}
TEST_P(MetadataListTest, clearShouldClearLoadedData) {
TEST_F(MetadataListTest, clearShouldClearLoadedData) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
ASSERT_FALSE(metadataList.Messages().empty());
@@ -355,7 +352,7 @@ TEST_P(MetadataListTest, clearShouldClearLoadedData) {
EXPECT_TRUE(metadataList.BashTags().empty());
}
TEST_P(MetadataListTest, setGroupsShouldReplaceExistingGroups) {
TEST_F(MetadataListTest, setGroupsShouldReplaceExistingGroups) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -372,14 +369,14 @@ TEST_P(MetadataListTest, setGroupsShouldReplaceExistingGroups) {
EXPECT_TRUE(groups[1].GetAfterGroups().empty());
}
TEST_P(
TEST_F(
MetadataListTest,
findPluginShouldReturnAnEmptyOptionalIfTheGivenPluginIsNotInTheMetadataList) {
MetadataList metadataList;
EXPECT_FALSE(metadataList.FindPlugin(blankDifferentEsm));
}
TEST_P(
TEST_F(
MetadataListTest,
findPluginShouldReturnTheMetadataObjectInTheMetadataListIfOneExistsForTheGivenPlugin) {
MetadataList metadataList;
@@ -398,7 +395,7 @@ TEST_P(
plugin.GetIncompatibilities());
}
TEST_P(MetadataListTest, addPluginShouldStoreGivenSpecificPluginMetadata) {
TEST_F(MetadataListTest, addPluginShouldStoreGivenSpecificPluginMetadata) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
ASSERT_FALSE(metadataList.FindPlugin(blankDifferentEsm));
@@ -413,7 +410,7 @@ TEST_P(MetadataListTest, addPluginShouldStoreGivenSpecificPluginMetadata) {
EXPECT_EQ("group1", plugin.GetGroup());
}
TEST_P(MetadataListTest, addPluginShouldStoreGivenRegexPluginMetadata) {
TEST_F(MetadataListTest, addPluginShouldStoreGivenRegexPluginMetadata) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -426,7 +423,7 @@ TEST_P(MetadataListTest, addPluginShouldStoreGivenRegexPluginMetadata) {
EXPECT_EQ("group1", plugin.GetGroup());
}
TEST_P(MetadataListTest, addPluginShouldThrowIfAMatchingPluginAlreadyExists) {
TEST_F(MetadataListTest, addPluginShouldThrowIfAMatchingPluginAlreadyExists) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
@@ -437,7 +434,7 @@ TEST_P(MetadataListTest, addPluginShouldThrowIfAMatchingPluginAlreadyExists) {
std::invalid_argument);
}
TEST_P(MetadataListTest,
TEST_F(MetadataListTest,
erasePluginShouldRemoveStoredMetadataForTheGivenPlugin) {
MetadataList metadataList;
ASSERT_NO_THROW(metadataList.Load(metadataPath));
+3 -1
View File
@@ -32,9 +32,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class PluginTest : public CommonGameTestFixture {
class PluginTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
PluginTest() :
CommonGameTestFixture(GetParam()),
emptyFile("EmptyFile.esm"),
lowercaseBlankEsp("blank.esp"),
nonAsciiEsp(u8"non\u00C1scii.esp"),
@@ -33,9 +33,11 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class PluginSortTest : public CommonGameTestFixture {
class PluginSortTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
PluginSortTest() :
CommonGameTestFixture(GetParam()),
game_(GetParam(), gamePath, localPath),
blankEslEsp("Blank.esl.esp"),
cccPath_(gamePath / getCCCFilename()) {}
@@ -58,7 +60,7 @@ protected:
game.LoadPlugins({gameMasterPlugin}, true);
plugins.erase(plugins.begin());
}
game.LoadPlugins(plugins, headersOnly);
}
@@ -84,9 +86,8 @@ protected:
}
}
PluginSortingData CreatePluginSortingData(
const std::string& name,
const size_t loadOrderIndex) {
PluginSortingData CreatePluginSortingData(const std::string& name,
const size_t loadOrderIndex) {
const auto plugin = GetPlugin(name);
return PluginSortingData(
@@ -1156,7 +1157,7 @@ TEST_P(PluginSortTest, sortingShouldThrowIfAGivenPluginIsNotLoaded) {
game_.ClearLoadedPlugins();
std::vector<std::string> plugins{blankEsp, blankDifferentEsp};
EXPECT_THROW(SortPlugins(game_, plugins), std::invalid_argument);
}
}
@@ -30,10 +30,13 @@ along with LOOT. If not, see
namespace loot {
namespace test {
class PluginSortingDataTest : public CommonGameTestFixture {
class PluginSortingDataTest : public CommonGameTestFixture,
public testing::WithParamInterface<GameType> {
protected:
PluginSortingDataTest() :
game_(GetParam(), gamePath, localPath), blankEslEsp("Blank.esl.esp") {}
CommonGameTestFixture(GetParam()),
game_(GetParam(), gamePath, localPath),
blankEslEsp("Blank.esl.esp") {}
void loadInstalledPlugins(Game &game, bool headersOnly) {
auto plugins = GetInstalledPlugins();
+31 -29
View File
@@ -54,9 +54,10 @@ static const std::array<GameType, 11> ALL_GAME_TYPES = {
GameType::openmw,
};
class CommonGameTestFixture : public ::testing::TestWithParam<GameType> {
class CommonGameTestFixture : public ::testing::Test {
protected:
CommonGameTestFixture() :
CommonGameTestFixture(GameType gameType) :
gameType_(gameType),
rootTestPath(getRootTestPath()),
french("fr"),
german("de"),
@@ -104,7 +105,7 @@ protected:
auto sourcePluginsPath = getSourcePluginsPath();
if (GetParam() == GameType::starfield) {
if (gameType_ == GameType::starfield) {
copyPlugin(sourcePluginsPath, blankFullEsm);
copyPlugin(sourcePluginsPath, blankMediumEsm);
@@ -145,8 +146,8 @@ protected:
copyPlugin(sourcePluginsPath, blankDifferentPluginDependentEsp);
}
if (supportsLightPlugins(GetParam())) {
if (GetParam() == GameType::starfield) {
if (supportsLightPlugins(gameType_)) {
if (gameType_ == GameType::starfield) {
std::filesystem::copy_file(sourcePluginsPath / "Blank.small.esm",
dataPath / blankEsl);
ASSERT_TRUE(exists(dataPath / blankEsl));
@@ -164,7 +165,7 @@ protected:
setLoadOrder(getInitialLoadOrder());
// Ghost a plugin, except for OpenMW.
if (GetParam() != GameType::openmw) {
if (gameType_ != GameType::openmw) {
ASSERT_NO_THROW(std::filesystem::rename(
dataPath / blankMasterDependentEsm,
dataPath / (blankMasterDependentEsm + ".ghost")));
@@ -219,7 +220,7 @@ protected:
std::vector<std::string> getLoadOrder() {
std::vector<std::string> actual;
if (isLoadOrderTimestampBased(GetParam())) {
if (isLoadOrderTimestampBased(gameType_)) {
std::map<std::filesystem::file_time_type, std::string> loadOrder;
for (std::filesystem::directory_iterator it(dataPath);
it != std::filesystem::directory_iterator();
@@ -237,7 +238,7 @@ protected:
}
}
for (const auto& plugin : loadOrder) actual.push_back(plugin.second);
} else if (GetParam() == GameType::tes5) {
} else if (gameType_ == GameType::tes5) {
std::ifstream in(localPath / "loadorder.txt");
while (in) {
std::string line;
@@ -246,7 +247,7 @@ protected:
if (!line.empty())
actual.push_back(line);
}
} else if (GetParam() == GameType::openmw) {
} else if (gameType_ == GameType::openmw) {
throw std::runtime_error(
"OpenMW's load order derivation is too complicated to replicate "
"accurately just for a test.");
@@ -264,7 +265,7 @@ protected:
std::vector<std::pair<std::string, bool>> getInitialLoadOrder() const {
std::vector<std::pair<std::string, bool>> loadOrder;
if (GetParam() == GameType::starfield) {
if (gameType_ == GameType::starfield) {
loadOrder = {
{masterFile, true},
{blankEsm, true},
@@ -292,7 +293,7 @@ protected:
{blankDifferentPluginDependentEsp, false},
};
if (supportsLightPlugins(GetParam())) {
if (supportsLightPlugins(gameType_)) {
loadOrder.insert(loadOrder.begin() + 5,
std::make_pair(blankEsl, false));
}
@@ -302,7 +303,7 @@ protected:
}
std::filesystem::path getSourcePluginsPath() const {
return loot::test::getSourcePluginsPath(GetParam());
return loot::test::getSourcePluginsPath(gameType_);
}
void touch(const std::filesystem::path& path) {
@@ -330,7 +331,7 @@ protected:
}
std::vector<std::filesystem::path> GetInstalledPlugins() {
if (GetParam() == GameType::starfield) {
if (gameType_ == GameType::starfield) {
return {
masterFile,
blankEsm,
@@ -367,6 +368,7 @@ protected:
}
private:
GameType gameType_;
const std::filesystem::path rootTestPath;
protected:
@@ -401,29 +403,29 @@ protected:
private:
std::string getMasterFile() const {
if (GetParam() == GameType::tes3 || GetParam() == GameType::openmw)
if (gameType_ == GameType::tes3 || gameType_ == GameType::openmw)
return "Morrowind.esm";
else if (GetParam() == GameType::tes4)
else if (gameType_ == GameType::tes4)
return "Oblivion.esm";
else if (GetParam() == GameType::tes5 || GetParam() == GameType::tes5se ||
GetParam() == GameType::tes5vr)
else if (gameType_ == GameType::tes5 || gameType_ == GameType::tes5se ||
gameType_ == GameType::tes5vr)
return "Skyrim.esm";
else if (GetParam() == GameType::fo3)
else if (gameType_ == GameType::fo3)
return "Fallout3.esm";
else if (GetParam() == GameType::fonv)
else if (gameType_ == GameType::fonv)
return "FalloutNV.esm";
else if (GetParam() == GameType::fo4 || GetParam() == GameType::fo4vr)
else if (gameType_ == GameType::fo4 || gameType_ == GameType::fo4vr)
return "Fallout4.esm";
else if (GetParam() == GameType::starfield)
else if (gameType_ == GameType::starfield)
return "Starfield.esm";
else
throw std::logic_error("Unrecognised game type");
}
std::string getPluginsFolder() const {
if (GetParam() == GameType::openmw) {
if (gameType_ == GameType::openmw) {
return "resources/vfs";
} else if (GetParam() == GameType::tes3) {
} else if (gameType_ == GameType::tes3) {
return "Data Files";
} else {
return "Data";
@@ -431,7 +433,7 @@ private:
}
uint32_t getBlankEsmCrc() const {
switch (GetParam()) {
switch (gameType_) {
case GameType::tes3:
case GameType::openmw:
return 0x790DC6FB;
@@ -446,14 +448,14 @@ private:
void setLoadOrder(
const std::vector<std::pair<std::string, bool>>& loadOrder) const {
if (GetParam() == GameType::tes3) {
if (gameType_ == GameType::tes3) {
std::ofstream out(gamePath / "Morrowind.ini");
for (const auto& plugin : loadOrder) {
if (plugin.second) {
out << "GameFile0=" << plugin.first << std::endl;
}
}
} else if (GetParam() == GameType::openmw) {
} else if (gameType_ == GameType::openmw) {
std::ofstream out(localPath / "openmw.cfg");
for (const auto& plugin : loadOrder) {
@@ -464,7 +466,7 @@ private:
} else {
std::ofstream out(localPath / "Plugins.txt");
for (const auto& plugin : loadOrder) {
if (supportsLightPlugins(GetParam())) {
if (supportsLightPlugins(gameType_)) {
if (plugin.second)
out << '*';
} else if (!plugin.second)
@@ -474,7 +476,7 @@ private:
}
}
if (isLoadOrderTimestampBased(GetParam())) {
if (isLoadOrderTimestampBased(gameType_)) {
std::filesystem::file_time_type modificationTime =
std::filesystem::file_time_type::clock::now();
for (const auto& plugin : loadOrder) {
@@ -489,7 +491,7 @@ private:
}
modificationTime += std::chrono::seconds(60);
}
} else if (GetParam() == GameType::tes5) {
} else if (gameType_ == GameType::tes5) {
std::ofstream out(localPath / "loadorder.txt");
for (const auto& plugin : loadOrder) out << plugin.first << std::endl;
}