mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Don't use test fixtures unnecessarily
They're very slow due to their filesystem operations. This reduces the tests running time from 27s to 25s locally.
This commit is contained in:
@@ -30,8 +30,6 @@ along with LOOT. If not, see
|
||||
#include "loot/metadata/message_content.h"
|
||||
|
||||
namespace loot::test {
|
||||
const std::string french = "fr";
|
||||
|
||||
TEST(MessageContent, defaultConstructorShouldSetEmptyEnglishLanguageString) {
|
||||
MessageContent content;
|
||||
|
||||
@@ -40,10 +38,10 @@ TEST(MessageContent, defaultConstructorShouldSetEmptyEnglishLanguageString) {
|
||||
}
|
||||
|
||||
TEST(MessageContent, contentConstructorShouldStoreGivenStringAndLanguage) {
|
||||
MessageContent content("content", french);
|
||||
MessageContent content("content", "fr");
|
||||
|
||||
EXPECT_EQ("content", content.GetText());
|
||||
EXPECT_EQ(french, content.GetLanguage());
|
||||
EXPECT_EQ("fr", content.GetLanguage());
|
||||
}
|
||||
|
||||
TEST(MessageContent,
|
||||
|
||||
@@ -25,37 +25,32 @@ along with LOOT. If not, see
|
||||
#ifndef LOOT_TESTS_API_INTERFACE_METADATA_MESSAGE_TEST
|
||||
#define LOOT_TESTS_API_INTERFACE_METADATA_MESSAGE_TEST
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "loot/metadata/message.h"
|
||||
#include "tests/common_game_test_fixture.h"
|
||||
|
||||
namespace loot::test {
|
||||
class MessageTest : public CommonGameTestFixture {
|
||||
protected:
|
||||
MessageTest() : CommonGameTestFixture(GameType::tes4) {}
|
||||
typedef std::vector<MessageContent> MessageContents;
|
||||
};
|
||||
|
||||
TEST_F(MessageTest, defaultConstructorShouldCreateNoteWithNoContent) {
|
||||
TEST(Message, defaultConstructorShouldCreateNoteWithNoContent) {
|
||||
Message message;
|
||||
EXPECT_EQ(MessageType::say, message.GetType());
|
||||
EXPECT_EQ(MessageContents(), message.GetContent());
|
||||
EXPECT_TRUE(message.GetContent().empty());
|
||||
}
|
||||
|
||||
TEST_F(MessageTest,
|
||||
scalarContentConstructorShouldCreateAMessageWithASingleContentString) {
|
||||
TEST(Message,
|
||||
scalarContentConstructorShouldCreateAMessageWithASingleContentString) {
|
||||
MessageContent content = MessageContent("content1");
|
||||
Message message(MessageType::warn, content.GetText(), "condition1");
|
||||
|
||||
EXPECT_EQ(MessageType::warn, message.GetType());
|
||||
EXPECT_EQ(MessageContents({content}), message.GetContent());
|
||||
EXPECT_EQ(std::vector<MessageContent>({content}), message.GetContent());
|
||||
EXPECT_EQ("condition1", message.GetCondition());
|
||||
}
|
||||
|
||||
TEST_F(MessageTest,
|
||||
vectorContentConstructorShouldCreateAMessageWithGivenContentStrings) {
|
||||
MessageContents contents({
|
||||
TEST(Message,
|
||||
vectorContentConstructorShouldCreateAMessageWithGivenContentStrings) {
|
||||
std::vector<MessageContent> contents({
|
||||
MessageContent("content1"),
|
||||
MessageContent("content2", french),
|
||||
MessageContent("content2", "fr"),
|
||||
});
|
||||
Message message(MessageType::error, contents, "condition1");
|
||||
|
||||
@@ -64,18 +59,18 @@ TEST_F(MessageTest,
|
||||
EXPECT_EQ("condition1", message.GetCondition());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
MessageTest,
|
||||
TEST(
|
||||
Message,
|
||||
vectorContentConstructorShouldThrowIfMultipleContentStringsAreGivenAndNoneAreEnglish) {
|
||||
MessageContents contents({
|
||||
MessageContent("content1", german),
|
||||
MessageContent("content2", french),
|
||||
std::vector<MessageContent> contents({
|
||||
MessageContent("content1", "de"),
|
||||
MessageContent("content2", "fr"),
|
||||
});
|
||||
EXPECT_THROW(Message(MessageType::error, contents, "condition1"),
|
||||
std::invalid_argument);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, equalityShouldRequireEqualMessageTypes) {
|
||||
TEST(Message, equalityShouldRequireEqualMessageTypes) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -87,7 +82,7 @@ TEST_F(MessageTest, equalityShouldRequireEqualMessageTypes) {
|
||||
EXPECT_FALSE(message1 == message2);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
|
||||
TEST(Message, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
|
||||
Message message1(MessageType::say, "content", "condition");
|
||||
Message message2(MessageType::say, "content", "condition");
|
||||
|
||||
@@ -104,7 +99,7 @@ TEST_F(MessageTest, equalityShouldRequireCaseSensitiveEqualityOnCondition) {
|
||||
EXPECT_FALSE(message1 == message2);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, equalityShouldRequireEqualContent) {
|
||||
TEST(Message, equalityShouldRequireEqualContent) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -116,7 +111,7 @@ TEST_F(MessageTest, equalityShouldRequireEqualContent) {
|
||||
EXPECT_FALSE(message1 == message2);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, inequalityShouldBeTheInverseOfEquality) {
|
||||
TEST(Message, inequalityShouldBeTheInverseOfEquality) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -153,7 +148,7 @@ TEST_F(MessageTest, inequalityShouldBeTheInverseOfEquality) {
|
||||
EXPECT_TRUE(message1 != message2);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
|
||||
TEST(Message, lessThanOperatorShouldCompareMessageTypes) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -167,7 +162,7 @@ TEST_F(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
|
||||
EXPECT_FALSE(message2 < message1);
|
||||
}
|
||||
|
||||
TEST_F(MessageTest, lessThanOperatorShouldCompareContent) {
|
||||
TEST(Message, lessThanOperatorShouldCompareContent) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -181,8 +176,8 @@ TEST_F(MessageTest, lessThanOperatorShouldCompareContent) {
|
||||
EXPECT_FALSE(message2 < message1);
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
MessageTest,
|
||||
TEST(
|
||||
Message,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForConditions) {
|
||||
Message message1(MessageType::say, "content", "condition");
|
||||
Message message2(MessageType::say, "content", "condition");
|
||||
@@ -203,9 +198,8 @@ TEST_F(
|
||||
EXPECT_FALSE(message2 < message1);
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
MessageTest,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondMessageIsLessThanTheFirst) {
|
||||
TEST(Message,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondMessageIsLessThanTheFirst) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
@@ -249,8 +243,8 @@ TEST_F(
|
||||
EXPECT_TRUE(message2 > message1);
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
MessageTest,
|
||||
TEST(
|
||||
Message,
|
||||
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstMessageIsNotGreaterThanTheSecond) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
@@ -295,8 +289,8 @@ TEST_F(
|
||||
EXPECT_FALSE(message2 <= message1);
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
MessageTest,
|
||||
TEST(
|
||||
Message,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstMessageIsNotLessThanTheSecond) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,19 +29,8 @@ along with LOOT. If not, see
|
||||
#include "tests/common_game_test_fixture.h"
|
||||
|
||||
namespace loot::test {
|
||||
class PluginMetadataTest : public CommonGameTestFixture {
|
||||
protected:
|
||||
PluginMetadataTest() :
|
||||
CommonGameTestFixture(GameType::tes5),
|
||||
info_(std::vector<MessageContent>({
|
||||
MessageContent("info"),
|
||||
})) {}
|
||||
|
||||
const std::vector<MessageContent> info_;
|
||||
};
|
||||
|
||||
TEST_F(
|
||||
PluginMetadataTest,
|
||||
TEST(
|
||||
PluginMetadata,
|
||||
defaultConstructorShouldLeaveNameEmptyAndEnableMetadataAndLeaveGroupUnset) {
|
||||
PluginMetadata plugin;
|
||||
|
||||
@@ -49,50 +38,49 @@ TEST_F(
|
||||
EXPECT_FALSE(plugin.GetGroup());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
PluginMetadataTest,
|
||||
TEST(
|
||||
PluginMetadata,
|
||||
stringConstructorShouldSetNameToGivenStringAndEnableMetadataAndLeaveGroupUnset) {
|
||||
PluginMetadata plugin(blankEsm);
|
||||
PluginMetadata plugin(BLANK_ESM);
|
||||
|
||||
EXPECT_EQ(blankEsm, plugin.GetName());
|
||||
EXPECT_EQ(BLANK_ESM, plugin.GetName());
|
||||
EXPECT_FALSE(plugin.GetGroup());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
nameMatchesShouldUseCaseInsensitiveNameComparisonForNonRegexNames) {
|
||||
PluginMetadata plugin(blankEsm);
|
||||
TEST(PluginMetadata,
|
||||
nameMatchesShouldUseCaseInsensitiveNameComparisonForNonRegexNames) {
|
||||
PluginMetadata plugin(BLANK_ESM);
|
||||
|
||||
EXPECT_TRUE(plugin.NameMatches("blank.esm"));
|
||||
EXPECT_FALSE(plugin.NameMatches(blankDifferentEsm));
|
||||
EXPECT_FALSE(plugin.NameMatches(BLANK_DIFFERENT_ESM));
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
nameMatchesShouldTreatGivenPluginNameStringsAsLiterals) {
|
||||
PluginMetadata plugin(blankEsm);
|
||||
TEST(PluginMetadata, nameMatchesShouldTreatGivenPluginNameStringsAsLiterals) {
|
||||
PluginMetadata plugin(BLANK_ESM);
|
||||
std::string regex = "blan.\\.esm";
|
||||
|
||||
EXPECT_FALSE(plugin.NameMatches(regex));
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
nameMatchesShouldUseCaseInsensitiveRegexMatchingForARegexName) {
|
||||
TEST(PluginMetadata,
|
||||
nameMatchesShouldUseCaseInsensitiveRegexMatchingForARegexName) {
|
||||
PluginMetadata plugin("Blan.\\.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.NameMatches("blank.esm"));
|
||||
EXPECT_FALSE(plugin.NameMatches(blankDifferentEsm));
|
||||
EXPECT_FALSE(plugin.NameMatches(BLANK_DIFFERENT_ESM));
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldNotChangeName) {
|
||||
PluginMetadata plugin1(blankEsm);
|
||||
PluginMetadata plugin2(blankDifferentEsm);
|
||||
TEST(PluginMetadata, mergeMetadataShouldNotChangeName) {
|
||||
PluginMetadata plugin1(BLANK_ESM);
|
||||
PluginMetadata plugin2(BLANK_DIFFERENT_ESM);
|
||||
|
||||
plugin1.MergeMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(blankEsm, plugin1.GetName());
|
||||
EXPECT_EQ(BLANK_ESM, plugin1.GetName());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
mergeMetadataShouldNotUseMergedGroupIfItAndCurrentGroupAreBothExplicit) {
|
||||
TEST(PluginMetadata,
|
||||
mergeMetadataShouldNotUseMergedGroupIfItAndCurrentGroupAreBothExplicit) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
@@ -103,8 +91,8 @@ TEST_F(PluginMetadataTest,
|
||||
EXPECT_EQ("group1", plugin1.GetGroup());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
mergeMetadataShouldNotUseMergedGroupIfItAndCurrentGroupAreBothImplicit) {
|
||||
TEST(PluginMetadata,
|
||||
mergeMetadataShouldNotUseMergedGroupIfItAndCurrentGroupAreBothImplicit) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
@@ -113,8 +101,8 @@ TEST_F(PluginMetadataTest,
|
||||
EXPECT_FALSE(plugin1.GetGroup().has_value());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
PluginMetadataTest,
|
||||
TEST(
|
||||
PluginMetadata,
|
||||
mergeMetadataShouldNotUseMergedGroupIfItIsImplicitAndCurrentGroupIsExplicit) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
@@ -125,9 +113,8 @@ TEST_F(
|
||||
EXPECT_EQ("group1", plugin1.GetGroup());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
PluginMetadataTest,
|
||||
mergeMetadataShouldUseMergedGroupIfItIsExplicitAndCurrentGroupIsImplicit) {
|
||||
TEST(PluginMetadata,
|
||||
mergeMetadataShouldUseMergedGroupIfItIsExplicitAndCurrentGroupIsImplicit) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
|
||||
@@ -137,11 +124,11 @@ TEST_F(
|
||||
EXPECT_EQ("group2", plugin1.GetGroup());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeLoadAfterData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeLoadAfterData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file1(BLANK_ESM);
|
||||
File file2(BLANK_DIFFERENT_ESM);
|
||||
|
||||
plugin1.SetLoadAfterFiles({file1});
|
||||
plugin2.SetLoadAfterFiles({file1, file2});
|
||||
@@ -150,11 +137,11 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeLoadAfterData) {
|
||||
EXPECT_EQ(std::vector<File>({file1, file2}), plugin1.GetLoadAfterFiles());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeRequirementData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeRequirementData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file1(BLANK_ESM);
|
||||
File file2(BLANK_DIFFERENT_ESM);
|
||||
|
||||
plugin1.SetRequirements({file1});
|
||||
plugin2.SetRequirements({file1, file2});
|
||||
@@ -163,11 +150,11 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeRequirementData) {
|
||||
EXPECT_EQ(std::vector<File>({file1, file2}), plugin1.GetRequirements());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeIncompatibilityData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeIncompatibilityData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
File file1(blankEsm);
|
||||
File file2(blankDifferentEsm);
|
||||
File file1(BLANK_ESM);
|
||||
File file2(BLANK_DIFFERENT_ESM);
|
||||
|
||||
plugin1.SetIncompatibilities({file1});
|
||||
plugin2.SetIncompatibilities({file1, file2});
|
||||
@@ -176,7 +163,7 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeIncompatibilityData) {
|
||||
EXPECT_EQ(std::vector<File>({file1, file2}), plugin1.GetIncompatibilities());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeMessages) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeMessages) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Message message(MessageType::say, "content");
|
||||
@@ -188,7 +175,7 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeMessages) {
|
||||
EXPECT_EQ(std::vector<Message>({message, message}), plugin1.GetMessages());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeTags) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeTags) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Tag tag1("Relev");
|
||||
@@ -202,11 +189,13 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeTags) {
|
||||
EXPECT_EQ(std::vector<Tag>({tag1, tag2, tag3}), plugin1.GetTags());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeDirtyInfoData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeDirtyInfoData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginCleaningData info1(0x5, "utility", info_, 1, 2, 3, "condition");
|
||||
PluginCleaningData info2(0xA, "utility", info_, 1, 2, 3, "condition");
|
||||
PluginCleaningData info1(
|
||||
0x5, "utility", {MessageContent("info")}, 1, 2, 3, "condition");
|
||||
PluginCleaningData info2(
|
||||
0xA, "utility", {MessageContent("info")}, 1, 2, 3, "condition");
|
||||
|
||||
plugin1.SetDirtyInfo({info1});
|
||||
plugin2.SetDirtyInfo({info1, info2});
|
||||
@@ -215,7 +204,7 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeDirtyInfoData) {
|
||||
EXPECT_EQ(std::vector<PluginCleaningData>({info1, info2}),
|
||||
plugin1.GetDirtyInfo());
|
||||
}
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeCleanInfoData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeCleanInfoData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginCleaningData info1(0x5, "utility");
|
||||
@@ -229,7 +218,7 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeCleanInfoData) {
|
||||
plugin1.GetCleanInfo());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, mergeMetadataShouldMergeLocationData) {
|
||||
TEST(PluginMetadata, mergeMetadataShouldMergeLocationData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
Location location1("http://www.example.com/1");
|
||||
@@ -243,7 +232,7 @@ TEST_F(PluginMetadataTest, mergeMetadataShouldMergeLocationData) {
|
||||
plugin1.GetLocations());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, unsetGroupShouldLeaveNoGroupValueSet) {
|
||||
TEST(PluginMetadata, unsetGroupShouldLeaveNoGroupValueSet) {
|
||||
PluginMetadata plugin;
|
||||
EXPECT_FALSE(plugin.GetGroup().has_value());
|
||||
|
||||
@@ -254,137 +243,134 @@ TEST_F(PluginMetadataTest, unsetGroupShouldLeaveNoGroupValueSet) {
|
||||
EXPECT_FALSE(plugin.GetGroup().has_value());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
hasNameOnlyShouldBeTrueForADefaultConstructedPluginMetadataObject) {
|
||||
TEST(PluginMetadata,
|
||||
hasNameOnlyShouldBeTrueForADefaultConstructedPluginMetadataObject) {
|
||||
PluginMetadata plugin;
|
||||
|
||||
EXPECT_TRUE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
hasNameOnlyShouldBeTrueForAPluginMetadataObjectConstructedWithAName) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
TEST(PluginMetadata,
|
||||
hasNameOnlyShouldBeTrueForAPluginMetadataObjectConstructedWithAName) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
|
||||
EXPECT_TRUE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfTheGroupIsExplicit) {
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfTheGroupIsExplicit) {
|
||||
PluginMetadata plugin;
|
||||
plugin.SetGroup("group");
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfLoadAfterMetadataExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.SetLoadAfterFiles({File(blankEsm)});
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfLoadAfterMetadataExists) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetLoadAfterFiles({File(BLANK_ESM)});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
hasNameOnlyShouldBeFalseIfRequirementMetadataExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.SetRequirements({File(blankEsm)});
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfRequirementMetadataExists) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetRequirements({File(BLANK_ESM)});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
hasNameOnlyShouldBeFalseIfIncompatibilityMetadataExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.SetIncompatibilities({File(blankEsm)});
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfIncompatibilityMetadataExists) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetIncompatibilities({File(BLANK_ESM)});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfMessagesExist) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfMessagesExist) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetMessages({Message(MessageType::say, "content")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfTagsExist) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfTagsExist) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetTags({Tag("Relev")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfDirtyInfoExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.SetDirtyInfo(
|
||||
{PluginCleaningData(5, "utility", info_, 0, 1, 2, "condition")});
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfDirtyInfoExists) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetDirtyInfo({PluginCleaningData(
|
||||
5, "utility", {MessageContent("info")}, 0, 1, 2, "condition")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfCleanInfoExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfCleanInfoExists) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetCleanInfo({PluginCleaningData(5, "utility")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, hasNameOnlyShouldBeFalseIfLocationsExist) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
TEST(PluginMetadata, hasNameOnlyShouldBeFalseIfLocationsExist) {
|
||||
PluginMetadata plugin(BLANK_ESP);
|
||||
plugin.SetLocations({Location("http://www.example.com")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, isRegexPluginShouldBeFalseForAnEmptyPluginName) {
|
||||
TEST(PluginMetadata, isRegexPluginShouldBeFalseForAnEmptyPluginName) {
|
||||
PluginMetadata plugin;
|
||||
|
||||
EXPECT_FALSE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest, isRegexPluginShouldBeFalseForAnExactPluginFilename) {
|
||||
PluginMetadata plugin(blankEsm);
|
||||
TEST(PluginMetadata, isRegexPluginShouldBeFalseForAnExactPluginFilename) {
|
||||
PluginMetadata plugin(BLANK_ESM);
|
||||
|
||||
EXPECT_FALSE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAColon) {
|
||||
TEST(PluginMetadata, isRegexPluginShouldBeTrueIfThePluginNameContainsAColon) {
|
||||
PluginMetadata plugin("Blank:.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsABackslash) {
|
||||
TEST(PluginMetadata,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsABackslash) {
|
||||
PluginMetadata plugin("Blank\\.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAnAsterisk) {
|
||||
TEST(PluginMetadata,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAnAsterisk) {
|
||||
PluginMetadata plugin("Blank*.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAQuestionMark) {
|
||||
TEST(PluginMetadata,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAQuestionMark) {
|
||||
PluginMetadata plugin("Blank?.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAVerticalBar) {
|
||||
TEST(PluginMetadata,
|
||||
isRegexPluginShouldBeTrueIfThePluginNameContainsAVerticalBar) {
|
||||
PluginMetadata plugin("Blank|.esm");
|
||||
|
||||
EXPECT_TRUE(plugin.IsRegexPlugin());
|
||||
}
|
||||
|
||||
TEST_F(PluginMetadataTest,
|
||||
asYamlShouldReturnAStringContainingTheMetadataEmittedAsYaml) {
|
||||
PluginMetadata plugin(blankEsm);
|
||||
plugin.SetLoadAfterFiles({File(blankEsm)});
|
||||
TEST(PluginMetadata,
|
||||
asYamlShouldReturnAStringContainingTheMetadataEmittedAsYaml) {
|
||||
PluginMetadata plugin(BLANK_ESM);
|
||||
plugin.SetLoadAfterFiles({File(BLANK_ESM)});
|
||||
|
||||
EXPECT_EQ(
|
||||
"name: 'Blank.esm'\n"
|
||||
|
||||
@@ -54,38 +54,61 @@ static const std::array<GameType, 12> ALL_GAME_TYPES = {
|
||||
GameType::oblivionRemastered,
|
||||
};
|
||||
|
||||
inline constexpr std::string_view FRENCH = "fr";
|
||||
inline constexpr std::string_view GERMAN = "de";
|
||||
|
||||
inline constexpr std::string_view MISSING_ESP = "Blank.missing.esp";
|
||||
inline constexpr std::string_view NON_PLUGIN_FILE = "NotAPlugin.esm";
|
||||
inline constexpr std::string_view INVALID_PLUGIN = "Invalid.esm";
|
||||
inline constexpr std::string_view BLANK_ESM = "Blank.esm";
|
||||
inline constexpr std::string_view BLANK_FULL_ESM = "Blank.full.esm";
|
||||
inline constexpr std::string_view BLANK_MEDIUM_ESM = "Blank.medium.esm";
|
||||
inline constexpr std::string_view BLANK_DIFFERENT_ESM = "Blank - Different.esm";
|
||||
inline constexpr std::string_view BLANK_MASTER_DEPENDENT_ESM =
|
||||
"Blank - Master Dependent.esm";
|
||||
inline constexpr std::string_view BLANK_DIFFERENT_MASTER_DEPENDENT_ESM =
|
||||
"Blank - Different Master Dependent.esm";
|
||||
inline constexpr std::string_view BLANK_ESL = "Blank.esl";
|
||||
inline constexpr std::string_view BLANK_ESP = "Blank.esp";
|
||||
inline constexpr std::string_view BLANK_DIFFERENT_ESP = "Blank - Different.esp";
|
||||
inline constexpr std::string_view BLANK_MASTER_DEPENDENT_ESP =
|
||||
"Blank - Master Dependent.esp";
|
||||
inline constexpr std::string_view BLANK_DIFFERENT_MASTER_DEPENDENT_ESP =
|
||||
"Blank - Different Master Dependent.esp";
|
||||
inline constexpr std::string_view BLANK_PLUGIN_DEPENDENT_ESP =
|
||||
"Blank - Plugin Dependent.esp";
|
||||
inline constexpr std::string_view BLANK_DIFFERENT_PLUGIN_DEPENDENT_ESP =
|
||||
"Blank - Different Plugin Dependent.esp";
|
||||
|
||||
class CommonGameTestFixture : public ::testing::Test {
|
||||
protected:
|
||||
CommonGameTestFixture(GameType gameType) :
|
||||
gameType_(gameType),
|
||||
rootTestPath(getRootTestPath()),
|
||||
french("fr"),
|
||||
german("de"),
|
||||
french(FRENCH),
|
||||
german(GERMAN),
|
||||
missingPath(rootTestPath / "missing"),
|
||||
gamePath(rootTestPath / "games" / "game"),
|
||||
dataPath(gamePath / getPluginsFolder()),
|
||||
localPath(rootTestPath / "local" / "game"),
|
||||
metadataFilesPath(rootTestPath / "metadata"),
|
||||
masterFile(getMasterFile()),
|
||||
missingEsp("Blank.missing.esp"),
|
||||
nonPluginFile("NotAPlugin.esm"),
|
||||
invalidPlugin("Invalid.esm"),
|
||||
blankEsm("Blank.esm"),
|
||||
blankFullEsm("Blank.full.esm"),
|
||||
blankMediumEsm("Blank.medium.esm"),
|
||||
blankDifferentEsm("Blank - Different.esm"),
|
||||
blankMasterDependentEsm("Blank - Master Dependent.esm"),
|
||||
blankDifferentMasterDependentEsm(
|
||||
"Blank - Different Master Dependent.esm"),
|
||||
blankEsl("Blank.esl"),
|
||||
blankEsp("Blank.esp"),
|
||||
blankDifferentEsp("Blank - Different.esp"),
|
||||
blankMasterDependentEsp("Blank - Master Dependent.esp"),
|
||||
blankDifferentMasterDependentEsp(
|
||||
"Blank - Different Master Dependent.esp"),
|
||||
blankPluginDependentEsp("Blank - Plugin Dependent.esp"),
|
||||
blankDifferentPluginDependentEsp(
|
||||
"Blank - Different Plugin Dependent.esp"),
|
||||
missingEsp(MISSING_ESP),
|
||||
nonPluginFile(NON_PLUGIN_FILE),
|
||||
invalidPlugin(INVALID_PLUGIN),
|
||||
blankEsm(BLANK_ESM),
|
||||
blankFullEsm(BLANK_FULL_ESM),
|
||||
blankMediumEsm(BLANK_MEDIUM_ESM),
|
||||
blankDifferentEsm(BLANK_DIFFERENT_ESM),
|
||||
blankMasterDependentEsm(BLANK_MASTER_DEPENDENT_ESM),
|
||||
blankDifferentMasterDependentEsm(BLANK_DIFFERENT_MASTER_DEPENDENT_ESM),
|
||||
blankEsl(BLANK_ESL),
|
||||
blankEsp(BLANK_ESP),
|
||||
blankDifferentEsp(BLANK_DIFFERENT_ESP),
|
||||
blankMasterDependentEsp(BLANK_MASTER_DEPENDENT_ESP),
|
||||
blankDifferentMasterDependentEsp(BLANK_DIFFERENT_MASTER_DEPENDENT_ESP),
|
||||
blankPluginDependentEsp(BLANK_PLUGIN_DEPENDENT_ESP),
|
||||
blankDifferentPluginDependentEsp(BLANK_DIFFERENT_PLUGIN_DEPENDENT_ESP),
|
||||
blankEsmCrc(getBlankEsmCrc()) {
|
||||
assertInitialState();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user