mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add missing comparison operators for plugin metadata classes
This does not include the Group class, as that still needs its existing operator implementations updated.
This commit is contained in:
@@ -52,8 +52,8 @@ public:
|
||||
* @return A File object.
|
||||
*/
|
||||
LOOT_API explicit File(const std::string& name,
|
||||
const std::string& display = "",
|
||||
const std::string& condition = "");
|
||||
const std::string& display = "",
|
||||
const std::string& condition = "");
|
||||
|
||||
/**
|
||||
* A less-than operator implemented with no semantics so that File objects can
|
||||
@@ -85,6 +85,35 @@ private:
|
||||
std::string name_;
|
||||
std::string display_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two File objects are not equal.
|
||||
* @returns True if the File objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const File& lhs, const File& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first File object is greater than the second File object.
|
||||
* @returns True if the second File object is less than the first File object,
|
||||
* false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const File& lhs, const File& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first File object is less than or equal to the second File
|
||||
* object.
|
||||
* @returns True if the first File object is not greater than the second File
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const File& lhs, const File& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first File object is greater than or equal to the second File
|
||||
* object.
|
||||
* @returns True if the first File object is not less than the second File
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const File& lhs, const File& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,36 @@ private:
|
||||
std::string url_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two Location objects are not equal.
|
||||
* @returns True if the Location objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const Location& lhs, const Location& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Location object is greater than the second Location
|
||||
* object.
|
||||
* @returns True if the second Location object is less than the first Location
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const Location& lhs, const Location& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Location object is less than or equal to the second
|
||||
* Location object.
|
||||
* @returns True if the first Location object is not greater than the second
|
||||
* Location object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const Location& lhs, const Location& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Location object is greater than or equal to the second
|
||||
* Location object.
|
||||
* @returns True if the first Location object is not less than the second
|
||||
* Location object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const Location& lhs, const Location& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -124,6 +124,35 @@ private:
|
||||
MessageType type_;
|
||||
std::vector<MessageContent> content_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two Message objects are not equal.
|
||||
* @returns True if the Message objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const Message& lhs, const Message& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Message object is greater than the second Message object.
|
||||
* @returns True if the second Message object is less than the first Message
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const Message& lhs, const Message& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Message object is less than or equal to the second
|
||||
* Message object.
|
||||
* @returns True if the first Message object is not greater than the second
|
||||
* Message object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const Message& lhs, const Message& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Message object is greater than or equal to the second
|
||||
* Message object.
|
||||
* @returns True if the first Message object is not less than the second
|
||||
* Message object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const Message& lhs, const Message& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -103,6 +103,36 @@ private:
|
||||
std::string text_;
|
||||
std::string language_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two MessageContent objects are not equal.
|
||||
* @returns True if the MessageContent objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const MessageContent& lhs, const MessageContent& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first MessageContent object is greater than the second
|
||||
* MessageContent object.
|
||||
* @returns True if the second MessageContent object is less than the first
|
||||
* MessageContent object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const MessageContent& lhs, const MessageContent& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first MessageContent object is less than or equal to the second
|
||||
* MessageContent object.
|
||||
* @returns True if the first MessageContent object is not greater than the
|
||||
* second MessageContent object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const MessageContent& lhs, const MessageContent& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first MessageContent object is greater than or equal to the
|
||||
* second MessageContent object.
|
||||
* @returns True if the first MessageContent object is not less than the second
|
||||
* MessageContent object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const MessageContent& lhs, const MessageContent& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,8 @@ public:
|
||||
* The utility that the plugin cleanliness was checked with.
|
||||
* @return A PluginCleaningData object.
|
||||
*/
|
||||
LOOT_API explicit PluginCleaningData(uint32_t crc, const std::string& utility);
|
||||
LOOT_API explicit PluginCleaningData(uint32_t crc,
|
||||
const std::string& utility);
|
||||
|
||||
/**
|
||||
* Construct a PluginCleaningData object with the given values.
|
||||
@@ -76,11 +77,11 @@ public:
|
||||
* @return A PluginCleaningData object.
|
||||
*/
|
||||
LOOT_API explicit PluginCleaningData(uint32_t crc,
|
||||
const std::string& utility,
|
||||
const std::vector<MessageContent>& info,
|
||||
unsigned int itm,
|
||||
unsigned int ref,
|
||||
unsigned int nav);
|
||||
const std::string& utility,
|
||||
const std::vector<MessageContent>& info,
|
||||
unsigned int itm,
|
||||
unsigned int ref,
|
||||
unsigned int nav);
|
||||
/**
|
||||
* A less-than operator implemented with no semantics so that
|
||||
* PluginCleaningData objects can be stored in sets.
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
LOOT_API bool operator<(const PluginCleaningData& rhs) const;
|
||||
|
||||
/**
|
||||
* Check if two PluginCleaningData objects are equal by comparing their
|
||||
* Check if two PluginCleaningData objects are equal by comparing their
|
||||
* fields.
|
||||
* @returns True if the objects' fields are equal, false otherwise.
|
||||
*/
|
||||
@@ -153,6 +154,40 @@ private:
|
||||
std::string utility_;
|
||||
std::vector<MessageContent> info_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two MessageContent objects are not equal.
|
||||
* @returns True if the MessageContent objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const PluginCleaningData& lhs,
|
||||
const PluginCleaningData& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first PluginCleaningData object is greater than the second
|
||||
* PluginCleaningData object.
|
||||
* @returns True if the second PluginCleaningData object is less than the first
|
||||
* PluginCleaningData object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const PluginCleaningData& lhs,
|
||||
const PluginCleaningData& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first PluginCleaningData object is less than or equal to the
|
||||
* second PluginCleaningData object.
|
||||
* @returns True if the first PluginCleaningData object is not greater than the
|
||||
* second PluginCleaningData object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const PluginCleaningData& lhs,
|
||||
const PluginCleaningData& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first PluginCleaningData object is greater than or equal to the
|
||||
* second PluginCleaningData object.
|
||||
* @returns True if the first PluginCleaningData object is not less than the
|
||||
* second PluginCleaningData object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const PluginCleaningData& lhs,
|
||||
const PluginCleaningData& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
* @return A Tag object.
|
||||
*/
|
||||
LOOT_API explicit Tag(const std::string& tag,
|
||||
const bool isAddition = true,
|
||||
const std::string& condition = "");
|
||||
const bool isAddition = true,
|
||||
const std::string& condition = "");
|
||||
|
||||
/**
|
||||
* A less-than operator implemented with no semantics so that Tag objects
|
||||
@@ -86,6 +86,35 @@ private:
|
||||
std::string name_;
|
||||
bool addTag_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two Tag objects are not equal.
|
||||
* @returns True if the Tag objects are not equal, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator!=(const Tag& lhs, const Tag& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Tag object is greater than the second Tag object.
|
||||
* @returns True if the second Tag object is less than the first Tag object,
|
||||
* false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>(const Tag& lhs, const Tag& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Tag object is less than or equal to the second Tag
|
||||
* object.
|
||||
* @returns True if the first Tag object is not greater than the second Tag
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator<=(const Tag& lhs, const Tag& rhs);
|
||||
|
||||
/**
|
||||
* Check if the first Tag object is greater than or equal to the second Tag
|
||||
* object.
|
||||
* @returns True if the first Tag object is not less than the second Tag
|
||||
* object, false otherwise.
|
||||
*/
|
||||
LOOT_API bool operator>=(const Tag& lhs, const Tag& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,4 +70,12 @@ std::string File::GetDisplayName() const {
|
||||
else
|
||||
return display_;
|
||||
}
|
||||
|
||||
bool operator!=(const File& lhs, const File& rhs) { return !(lhs == rhs); }
|
||||
|
||||
bool operator>(const File& lhs, const File& rhs) { return rhs < lhs; }
|
||||
|
||||
bool operator<=(const File& lhs, const File& rhs) { return !(lhs > rhs); }
|
||||
|
||||
bool operator>=(const File& lhs, const File& rhs) { return !(lhs < rhs); }
|
||||
}
|
||||
|
||||
@@ -50,4 +50,18 @@ bool Location::operator==(const Location& rhs) const {
|
||||
std::string Location::GetURL() const { return url_; }
|
||||
|
||||
std::string Location::GetName() const { return name_; }
|
||||
|
||||
bool operator!=(const Location& lhs, const Location& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool operator>(const Location& lhs, const Location& rhs) { return rhs < lhs; }
|
||||
|
||||
bool operator<=(const Location& lhs, const Location& rhs) {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
bool operator>=(const Location& lhs, const Location& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,14 @@ SimpleMessage Message::ToSimpleMessage(const std::string& language) const {
|
||||
|
||||
return simpleMessage;
|
||||
}
|
||||
|
||||
bool operator!=(const Message& lhs, const Message& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool operator>(const Message& lhs, const Message& rhs) { return rhs < lhs; }
|
||||
|
||||
bool operator<=(const Message& lhs, const Message& rhs) { return !(lhs > rhs); }
|
||||
|
||||
bool operator>=(const Message& lhs, const Message& rhs) { return !(lhs < rhs); }
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ bool MessageContent::operator<(const MessageContent& rhs) const {
|
||||
bool MessageContent::operator==(const MessageContent& rhs) const {
|
||||
return text_ == rhs.text_ && language_ == rhs.language_;
|
||||
}
|
||||
|
||||
MessageContent MessageContent::Choose(const std::vector<MessageContent> content,
|
||||
const std::string& language) {
|
||||
if (content.empty())
|
||||
@@ -72,4 +73,20 @@ MessageContent MessageContent::Choose(const std::vector<MessageContent> content,
|
||||
return english;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator!=(const MessageContent& lhs, const MessageContent& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool operator>(const MessageContent& lhs, const MessageContent& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
bool operator<=(const MessageContent& lhs, const MessageContent& rhs) {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
bool operator>=(const MessageContent& lhs, const MessageContent& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,4 +121,20 @@ MessageContent PluginCleaningData::ChooseInfo(
|
||||
const std::string& language) const {
|
||||
return MessageContent::Choose(info_, language);
|
||||
}
|
||||
|
||||
bool operator!=(const PluginCleaningData& lhs, const PluginCleaningData& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool operator>(const PluginCleaningData& lhs, const PluginCleaningData& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
bool operator<=(const PluginCleaningData& lhs, const PluginCleaningData& rhs) {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
bool operator>=(const PluginCleaningData& lhs, const PluginCleaningData& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ bool Tag::operator<(const Tag& rhs) const {
|
||||
if (addTag_ != rhs.addTag_) {
|
||||
return addTag_ && !rhs.addTag_;
|
||||
}
|
||||
|
||||
|
||||
if (name_ < rhs.name_) {
|
||||
return true;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ bool Tag::operator<(const Tag& rhs) const {
|
||||
if (rhs.name_ < name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return GetCondition() < rhs.GetCondition();
|
||||
}
|
||||
|
||||
@@ -60,4 +60,12 @@ bool Tag::operator==(const Tag& rhs) const {
|
||||
bool Tag::IsAddition() const { return addTag_; }
|
||||
|
||||
std::string Tag::GetName() const { return name_; }
|
||||
|
||||
bool operator!=(const Tag& lhs, const Tag& rhs) { return !(lhs == rhs); }
|
||||
|
||||
bool operator>(const Tag& lhs, const Tag& rhs) { return rhs < lhs; }
|
||||
|
||||
bool operator<=(const Tag& lhs, const Tag& rhs) { return !(lhs > rhs); }
|
||||
|
||||
bool operator>=(const Tag& lhs, const Tag& rhs) { return !(lhs < rhs); }
|
||||
}
|
||||
|
||||
@@ -49,9 +49,7 @@ TEST(File, stringsConstructorShouldStoreGivenStrings) {
|
||||
EXPECT_EQ("condition", file.GetCondition());
|
||||
}
|
||||
|
||||
TEST(
|
||||
File,
|
||||
equalityShouldBeCaseInsensitiveOnNameAndDisplay) {
|
||||
TEST(File, equalityShouldBeCaseInsensitiveOnNameAndDisplay) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
@@ -95,9 +93,35 @@ TEST(File, equalityShouldBeCaseSensitiveOnDisplayAndCondition) {
|
||||
EXPECT_FALSE(file1 == file2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
File,
|
||||
lessThanOperatorShouldUseCaseInsensitiveLexicographicalComparisonForName) {
|
||||
TEST(File, inequalityShouldBeTheInverseOfEquality) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
EXPECT_FALSE(file1 != file2);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "Display", "condition");
|
||||
|
||||
EXPECT_TRUE(file1 != file2);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "display", "Condition");
|
||||
|
||||
EXPECT_TRUE(file1 != file2);
|
||||
|
||||
file1 = File("name", "display1", "condition");
|
||||
file2 = File("name", "display2", "condition");
|
||||
|
||||
EXPECT_TRUE(file1 != file2);
|
||||
|
||||
file1 = File("name", "display", "condition1");
|
||||
file2 = File("name", "display", "condition2");
|
||||
|
||||
EXPECT_TRUE(file1 != file2);
|
||||
}
|
||||
|
||||
TEST(File,
|
||||
lessThanOperatorShouldUseCaseInsensitiveLexicographicalComparisonForName) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
@@ -151,6 +175,106 @@ TEST(
|
||||
EXPECT_FALSE(file2 < file1);
|
||||
}
|
||||
|
||||
TEST(File, shouldAllowComparisonUsingGreaterThanOperator) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
EXPECT_FALSE(file1 > file2);
|
||||
EXPECT_FALSE(file2 > file1);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "Display", "condition");
|
||||
|
||||
EXPECT_FALSE(file2 > file1);
|
||||
EXPECT_TRUE(file1 > file2);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "display", "Condition");
|
||||
|
||||
EXPECT_FALSE(file2 > file1);
|
||||
EXPECT_TRUE(file1 > file2);
|
||||
|
||||
file1 = File("name", "display1");
|
||||
file2 = File("name", "display2");
|
||||
|
||||
EXPECT_FALSE(file1 > file2);
|
||||
EXPECT_TRUE(file2 > file1);
|
||||
|
||||
file1 = File("name", "display", "condition1");
|
||||
file2 = File("name", "display", "condition2");
|
||||
|
||||
EXPECT_FALSE(file1 > file2);
|
||||
EXPECT_TRUE(file2 > file1);
|
||||
}
|
||||
|
||||
TEST(
|
||||
File,
|
||||
lessThanOrEqualToOperatorShouldReturnTrueIfFirstFileIsNotGreaterThanSecondFile) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
EXPECT_TRUE(file1 <= file2);
|
||||
EXPECT_TRUE(file2 <= file1);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "Display", "condition");
|
||||
|
||||
EXPECT_TRUE(file2 <= file1);
|
||||
EXPECT_FALSE(file1 <= file2);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "display", "Condition");
|
||||
|
||||
EXPECT_TRUE(file2 <= file1);
|
||||
EXPECT_FALSE(file1 <= file2);
|
||||
|
||||
file1 = File("name", "display1");
|
||||
file2 = File("name", "display2");
|
||||
|
||||
EXPECT_TRUE(file1 <= file2);
|
||||
EXPECT_FALSE(file2 <= file1);
|
||||
|
||||
file1 = File("name", "display", "condition1");
|
||||
file2 = File("name", "display", "condition2");
|
||||
|
||||
EXPECT_TRUE(file1 <= file2);
|
||||
EXPECT_FALSE(file2 <= file1);
|
||||
}
|
||||
|
||||
TEST(
|
||||
File,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfFirstFileIsNotLessThanSecondFile) {
|
||||
File file1("name", "display", "condition");
|
||||
File file2("name", "display", "condition");
|
||||
|
||||
EXPECT_TRUE(file1 >= file2);
|
||||
EXPECT_TRUE(file2 >= file1);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "Display", "condition");
|
||||
|
||||
EXPECT_FALSE(file2 >= file1);
|
||||
EXPECT_TRUE(file1 >= file2);
|
||||
|
||||
file1 = File("name", "display", "condition");
|
||||
file2 = File("name", "display", "Condition");
|
||||
|
||||
EXPECT_FALSE(file2 >= file1);
|
||||
EXPECT_TRUE(file1 >= file2);
|
||||
|
||||
file1 = File("name", "display1");
|
||||
file2 = File("name", "display2");
|
||||
|
||||
EXPECT_FALSE(file1 >= file2);
|
||||
EXPECT_TRUE(file2 >= file1);
|
||||
|
||||
file1 = File("name", "display", "condition1");
|
||||
file2 = File("name", "display", "condition2");
|
||||
|
||||
EXPECT_FALSE(file1 >= file2);
|
||||
EXPECT_TRUE(file2 >= file1);
|
||||
}
|
||||
|
||||
TEST(File, emittingAsYamlShouldSingleQuoteValues) {
|
||||
File file("name1", "display1", "condition1");
|
||||
YAML::Emitter emitter;
|
||||
|
||||
@@ -74,8 +74,36 @@ TEST(Location, equalityShouldBeCaseSensitiveOnUrlAndName) {
|
||||
EXPECT_FALSE(location1 == location2);
|
||||
}
|
||||
|
||||
TEST(Location,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForNameAndUrl) {
|
||||
TEST(Location, inequalityShouldBeTheInverseOfEquality) {
|
||||
Location location1("http://www.example.com", "example");
|
||||
Location location2("http://www.example.com", "example");
|
||||
|
||||
EXPECT_FALSE(location1 != location2);
|
||||
|
||||
location1 = Location("http://www.example.com", "example");
|
||||
location2 = Location("HTTP://WWW.EXAMPLE.COM", "example");
|
||||
|
||||
EXPECT_TRUE(location1 != location2);
|
||||
|
||||
location1 = Location("http://www.example.com", "example");
|
||||
location2 = Location("http://www.example.com", "Example");
|
||||
|
||||
EXPECT_TRUE(location1 != location2);
|
||||
|
||||
location1 = Location("http://www.example1.com", "example");
|
||||
location2 = Location("http://www.example2.com", "example");
|
||||
|
||||
EXPECT_TRUE(location1 != location2);
|
||||
|
||||
location1 = Location("http://www.example.com", "example1");
|
||||
location2 = Location("http://www.example.com", "example2");
|
||||
|
||||
EXPECT_TRUE(location1 != location2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Location,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForNameAndUrl) {
|
||||
Location location1("http://www.example.com", "example");
|
||||
Location location2("http://www.example.com", "example");
|
||||
|
||||
@@ -107,6 +135,106 @@ TEST(Location,
|
||||
EXPECT_TRUE(location1 < location2);
|
||||
}
|
||||
|
||||
TEST(Location,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondLocationIsLessThanTheFirst) {
|
||||
Location location1("http://www.example.com", "example");
|
||||
Location location2("http://www.example.com", "example");
|
||||
|
||||
EXPECT_FALSE(location1 > location2);
|
||||
EXPECT_FALSE(location2 > location1);
|
||||
|
||||
location1 = Location("http://www.example.com");
|
||||
location2 = Location("HTTP://WWW.EXAMPLE.COM");
|
||||
|
||||
EXPECT_TRUE(location1 > location2);
|
||||
EXPECT_FALSE(location2 > location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example");
|
||||
location2 = Location("http://www.example.com", "Example");
|
||||
|
||||
EXPECT_TRUE(location1 > location2);
|
||||
EXPECT_FALSE(location2 > location1);
|
||||
|
||||
location1 = Location("http://www.example1.com");
|
||||
location2 = Location("http://www.example2.com");
|
||||
|
||||
EXPECT_FALSE(location1 > location2);
|
||||
EXPECT_TRUE(location2 > location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example1");
|
||||
location2 = Location("http://www.example.com", "example2");
|
||||
|
||||
EXPECT_TRUE(location2 > location1);
|
||||
EXPECT_FALSE(location1 > location2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Location,
|
||||
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstLocationIsNotGreaterThanTheSecond) {
|
||||
Location location1("http://www.example.com", "example");
|
||||
Location location2("http://www.example.com", "example");
|
||||
|
||||
EXPECT_TRUE(location1 <= location2);
|
||||
EXPECT_TRUE(location2 <= location1);
|
||||
|
||||
location1 = Location("http://www.example.com");
|
||||
location2 = Location("HTTP://WWW.EXAMPLE.COM");
|
||||
|
||||
EXPECT_FALSE(location1 <= location2);
|
||||
EXPECT_TRUE(location2 <= location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example");
|
||||
location2 = Location("http://www.example.com", "Example");
|
||||
|
||||
EXPECT_FALSE(location1 <= location2);
|
||||
EXPECT_TRUE(location2 <= location1);
|
||||
|
||||
location1 = Location("http://www.example1.com");
|
||||
location2 = Location("http://www.example2.com");
|
||||
|
||||
EXPECT_TRUE(location1 <= location2);
|
||||
EXPECT_FALSE(location2 <= location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example1");
|
||||
location2 = Location("http://www.example.com", "example2");
|
||||
|
||||
EXPECT_FALSE(location2 <= location1);
|
||||
EXPECT_TRUE(location1 <= location2);
|
||||
}
|
||||
|
||||
TEST(Location,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstLocationIsNotLessThanTheSecond) {
|
||||
Location location1("http://www.example.com", "example");
|
||||
Location location2("http://www.example.com", "example");
|
||||
|
||||
EXPECT_TRUE(location1 >= location2);
|
||||
EXPECT_TRUE(location2 >= location1);
|
||||
|
||||
location1 = Location("http://www.example.com");
|
||||
location2 = Location("HTTP://WWW.EXAMPLE.COM");
|
||||
|
||||
EXPECT_TRUE(location1 >= location2);
|
||||
EXPECT_FALSE(location2 >= location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example");
|
||||
location2 = Location("http://www.example.com", "Example");
|
||||
|
||||
EXPECT_TRUE(location1 >= location2);
|
||||
EXPECT_FALSE(location2 >= location1);
|
||||
|
||||
location1 = Location("http://www.example1.com");
|
||||
location2 = Location("http://www.example2.com");
|
||||
|
||||
EXPECT_FALSE(location1 >= location2);
|
||||
EXPECT_TRUE(location2 >= location1);
|
||||
|
||||
location1 = Location("http://www.example.com", "example1");
|
||||
location2 = Location("http://www.example.com", "example2");
|
||||
|
||||
EXPECT_TRUE(location2 >= location1);
|
||||
EXPECT_FALSE(location1 >= location2);
|
||||
}
|
||||
|
||||
TEST(Location, emittingAsYamlShouldOutputAScalarIfTheNameStringIsEmpty) {
|
||||
Location location("http://www.example.com");
|
||||
YAML::Emitter emitter;
|
||||
|
||||
@@ -49,7 +49,8 @@ TEST(MessageContent, contentConstructorShouldStoreGivenStringAndLanguage) {
|
||||
EXPECT_EQ(french, content.GetLanguage());
|
||||
}
|
||||
|
||||
TEST(MessageContent, equalityShouldRequireCaseSensitiveEqualityOnTextAndLanguage) {
|
||||
TEST(MessageContent,
|
||||
equalityShouldRequireCaseSensitiveEqualityOnTextAndLanguage) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
@@ -76,8 +77,36 @@ TEST(MessageContent, equalityShouldRequireCaseSensitiveEqualityOnTextAndLanguage
|
||||
EXPECT_FALSE(content1 == content2);
|
||||
}
|
||||
|
||||
TEST(MessageContent,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForTextAndLanguage) {
|
||||
TEST(MessageContent, inequalityShouldBeTheInverseOfEquality) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
EXPECT_FALSE(content1 != content2);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("Content", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 != content2);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "Fr");
|
||||
|
||||
EXPECT_TRUE(content1 != content2);
|
||||
|
||||
content1 = MessageContent("content1", "fr");
|
||||
content2 = MessageContent("content2", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 != content2);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "de");
|
||||
|
||||
EXPECT_TRUE(content1 != content2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
MessageContent,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForTextAndLanguage) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
@@ -109,6 +138,108 @@ TEST(MessageContent,
|
||||
EXPECT_FALSE(content1 < content2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
MessageContent,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondMessageContentIsLessThanTheFirst) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
EXPECT_FALSE(content1 > content2);
|
||||
EXPECT_FALSE(content2 > content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("Content", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 > content2);
|
||||
EXPECT_FALSE(content2 > content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "Fr");
|
||||
|
||||
EXPECT_FALSE(content2 > content1);
|
||||
EXPECT_TRUE(content1 > content2);
|
||||
|
||||
content1 = MessageContent("content1", "fr");
|
||||
content2 = MessageContent("content2", "fr");
|
||||
|
||||
EXPECT_FALSE(content1 > content2);
|
||||
EXPECT_TRUE(content2 > content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "de");
|
||||
|
||||
EXPECT_FALSE(content2 > content1);
|
||||
EXPECT_TRUE(content1 > content2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
MessageContent,
|
||||
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstMessageContentIsNotGreaterThanTheSecond) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 <= content2);
|
||||
EXPECT_TRUE(content2 <= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("Content", "fr");
|
||||
|
||||
EXPECT_FALSE(content1 <= content2);
|
||||
EXPECT_TRUE(content2 <= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "Fr");
|
||||
|
||||
EXPECT_TRUE(content2 <= content1);
|
||||
EXPECT_FALSE(content1 <= content2);
|
||||
|
||||
content1 = MessageContent("content1", "fr");
|
||||
content2 = MessageContent("content2", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 <= content2);
|
||||
EXPECT_FALSE(content2 <= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "de");
|
||||
|
||||
EXPECT_TRUE(content2 <= content1);
|
||||
EXPECT_FALSE(content1 <= content2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
MessageContent,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstMessageContentIsNotLessThanTheSecond) {
|
||||
MessageContent content1("content", "fr");
|
||||
MessageContent content2("content", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 >= content2);
|
||||
EXPECT_TRUE(content2 >= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("Content", "fr");
|
||||
|
||||
EXPECT_TRUE(content1 >= content2);
|
||||
EXPECT_FALSE(content2 >= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "Fr");
|
||||
|
||||
EXPECT_FALSE(content2 >= content1);
|
||||
EXPECT_TRUE(content1 >= content2);
|
||||
|
||||
content1 = MessageContent("content1", "fr");
|
||||
content2 = MessageContent("content2", "fr");
|
||||
|
||||
EXPECT_FALSE(content1 >= content2);
|
||||
EXPECT_TRUE(content2 >= content1);
|
||||
|
||||
content1 = MessageContent("content", "fr");
|
||||
content2 = MessageContent("content", "de");
|
||||
|
||||
EXPECT_FALSE(content2 >= content1);
|
||||
EXPECT_TRUE(content1 >= content2);
|
||||
}
|
||||
|
||||
TEST(MessageContent, emittingAsYamlShouldOutputDataCorrectly) {
|
||||
MessageContent content("content", french);
|
||||
YAML::Emitter emitter;
|
||||
|
||||
@@ -123,6 +123,43 @@ TEST_P(MessageTest, equalityShouldRequireEqualContent) {
|
||||
EXPECT_FALSE(message1 == message2);
|
||||
}
|
||||
|
||||
TEST_P(MessageTest, inequalityShouldBeTheInverseOfEquality) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
EXPECT_FALSE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::warn, "content");
|
||||
|
||||
EXPECT_TRUE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "condition");
|
||||
|
||||
EXPECT_FALSE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "Condition");
|
||||
|
||||
EXPECT_TRUE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition1");
|
||||
message2 = Message(MessageType::say, "content", "condition2");
|
||||
|
||||
EXPECT_TRUE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::say, "content");
|
||||
|
||||
EXPECT_FALSE(message1 != message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content1");
|
||||
message2 = Message(MessageType::say, "content2");
|
||||
|
||||
EXPECT_TRUE(message1 != message2);
|
||||
}
|
||||
|
||||
TEST_P(MessageTest, lessThanOperatorShouldCompareMessageTypes) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
@@ -173,6 +210,144 @@ TEST_P(
|
||||
EXPECT_FALSE(message2 < message1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
MessageTest,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondMessageIsLessThanTheFirst) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_FALSE(message2 > message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::warn, "content");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_TRUE(message2 > message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::say, "content");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_FALSE(message2 > message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content1");
|
||||
message2 = Message(MessageType::say, "content2");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_TRUE(message2 > message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "condition");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_FALSE(message2 > message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "Condition");
|
||||
|
||||
EXPECT_FALSE(message2 > message1);
|
||||
EXPECT_TRUE(message1 > message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition1");
|
||||
message2 = Message(MessageType::say, "content", "condition2");
|
||||
|
||||
EXPECT_FALSE(message1 > message2);
|
||||
EXPECT_TRUE(message2 > message1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
MessageTest,
|
||||
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstMessageIsNotGreaterThanTheSecond) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_TRUE(message2 <= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::warn, "content");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_FALSE(message2 <= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::say, "content");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_TRUE(message2 <= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content1");
|
||||
message2 = Message(MessageType::say, "content2");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_FALSE(message2 <= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "condition");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_TRUE(message2 <= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "Condition");
|
||||
|
||||
EXPECT_TRUE(message2 <= message1);
|
||||
EXPECT_FALSE(message1 <= message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition1");
|
||||
message2 = Message(MessageType::say, "content", "condition2");
|
||||
|
||||
EXPECT_TRUE(message1 <= message2);
|
||||
EXPECT_FALSE(message2 <= message1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
MessageTest,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstMessageIsNotLessThanTheSecond) {
|
||||
Message message1(MessageType::say, "content");
|
||||
Message message2(MessageType::say, "content");
|
||||
|
||||
EXPECT_TRUE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::warn, "content");
|
||||
|
||||
EXPECT_FALSE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content");
|
||||
message2 = Message(MessageType::say, "content");
|
||||
|
||||
EXPECT_TRUE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content1");
|
||||
message2 = Message(MessageType::say, "content2");
|
||||
|
||||
EXPECT_FALSE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "condition");
|
||||
|
||||
EXPECT_TRUE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition");
|
||||
message2 = Message(MessageType::say, "content", "Condition");
|
||||
|
||||
EXPECT_FALSE(message2 >= message1);
|
||||
EXPECT_TRUE(message1 >= message2);
|
||||
|
||||
message1 = Message(MessageType::say, "content", "condition1");
|
||||
message2 = Message(MessageType::say, "content", "condition2");
|
||||
|
||||
EXPECT_FALSE(message1 >= message2);
|
||||
EXPECT_TRUE(message2 >= message1);
|
||||
}
|
||||
|
||||
TEST_P(MessageTest, getContentShouldReturnADefaultContentObjectIfNoneExists) {
|
||||
Message message;
|
||||
EXPECT_EQ(MessageContent(),
|
||||
|
||||
@@ -105,6 +105,41 @@ TEST_P(PluginCleaningDataTest, equalityShouldCheckEqualityOfAllFields) {
|
||||
EXPECT_FALSE(info1 == info2);
|
||||
}
|
||||
|
||||
TEST_P(PluginCleaningDataTest, inequalityShouldBeTheInverseOfEquality) {
|
||||
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x87654321, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "Cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner1", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner2", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(
|
||||
0x12345678, "cleaner", std::vector<MessageContent>(), 2, 10, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 4, 10, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 20, 30);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 60);
|
||||
EXPECT_TRUE(info1 != info2);
|
||||
}
|
||||
|
||||
TEST_P(PluginCleaningDataTest, lessThanOperatorShouldCompareAllFields) {
|
||||
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
@@ -148,6 +183,141 @@ TEST_P(PluginCleaningDataTest, lessThanOperatorShouldCompareAllFields) {
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
PluginCleaningDataTest,
|
||||
greaterThanOperatorShouldReturnTrueIfTheSecondPluginCleaningDataIsLessThanTheFirst) {
|
||||
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_FALSE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x87654321, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "Cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info2 > info1);
|
||||
EXPECT_TRUE(info1 > info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner1", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner2", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(
|
||||
0x12345678, "cleaner", std::vector<MessageContent>(), 2, 10, 30);
|
||||
EXPECT_FALSE(info2 > info1);
|
||||
EXPECT_TRUE(info1 > info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 4, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 20, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 60);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
PluginCleaningDataTest,
|
||||
lessThanOrEqualOperatorShouldReturnTrueIfTheFirstPluginCleaningDataIsNotGreaterThanTheSecond) {
|
||||
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 <= info2);
|
||||
EXPECT_TRUE(info2 <= info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x87654321, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "Cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info2 < info1);
|
||||
EXPECT_FALSE(info1 < info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner1", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner2", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(
|
||||
0x12345678, "cleaner", std::vector<MessageContent>(), 2, 10, 30);
|
||||
EXPECT_TRUE(info2 < info1);
|
||||
EXPECT_FALSE(info1 < info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 4, 10, 30);
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 20, 30);
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 60);
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
}
|
||||
|
||||
TEST_P(
|
||||
PluginCleaningDataTest,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstPluginCleaningDataIsNotLessThanTheSecond) {
|
||||
PluginCleaningData info1(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
PluginCleaningData info2(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_TRUE(info1 >= info2);
|
||||
EXPECT_TRUE(info2 >= info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x87654321, "cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "Cleaner", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info2 > info1);
|
||||
EXPECT_TRUE(info1 > info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner1", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner2", info_, 2, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(
|
||||
0x12345678, "cleaner", std::vector<MessageContent>(), 2, 10, 30);
|
||||
EXPECT_FALSE(info2 > info1);
|
||||
EXPECT_TRUE(info1 > info2);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 4, 10, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 20, 30);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
|
||||
info1 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 30);
|
||||
info2 = PluginCleaningData(0x12345678, "cleaner", info_, 2, 10, 60);
|
||||
EXPECT_FALSE(info1 > info2);
|
||||
EXPECT_TRUE(info2 > info1);
|
||||
}
|
||||
|
||||
TEST_P(PluginCleaningDataTest,
|
||||
chooseInfoShouldCreateADefaultContentObjectIfNoneExists) {
|
||||
PluginCleaningData dirtyInfo(
|
||||
|
||||
@@ -89,8 +89,46 @@ TEST(Tag, equalityShouldRequireEqualAdditionStates) {
|
||||
EXPECT_FALSE(tag1 == tag2);
|
||||
}
|
||||
|
||||
TEST(Tag,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForNameAndCondition) {
|
||||
TEST(Tag, inequalityShouldBeTheInverseOfEquality) {
|
||||
Tag tag1("name", true, "condition");
|
||||
Tag tag2("name", true, "condition");
|
||||
|
||||
EXPECT_FALSE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name");
|
||||
tag2 = Tag("Name");
|
||||
|
||||
EXPECT_TRUE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name", true, "condition");
|
||||
tag2 = Tag("name", true, "Condition");
|
||||
|
||||
EXPECT_TRUE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name1");
|
||||
tag2 = Tag("name2");
|
||||
|
||||
EXPECT_TRUE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name", true, "condition1");
|
||||
tag2 = Tag("name", true, "condition2");
|
||||
|
||||
EXPECT_TRUE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name", true, "condition");
|
||||
tag2 = Tag("name", true, "condition");
|
||||
|
||||
EXPECT_FALSE(tag1 != tag2);
|
||||
|
||||
tag1 = Tag("name", true);
|
||||
tag2 = Tag("name", false);
|
||||
|
||||
EXPECT_TRUE(tag1 != tag2);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Tag,
|
||||
lessThanOperatorShouldUseCaseSensitiveLexicographicalComparisonForNameAndCondition) {
|
||||
Tag tag1("name", true, "condition");
|
||||
Tag tag2("name", true, "condition");
|
||||
|
||||
@@ -130,6 +168,123 @@ TEST(Tag, lessThanOperatorShouldTreatTagAdditionsAsBeingLessThanRemovals) {
|
||||
EXPECT_FALSE(tag2 < tag1);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Tag, greaterThanOperatorShouldReturnTrueIfTheSecondTagIsLessThanTheFirst) {
|
||||
Tag tag1("name", true, "condition");
|
||||
Tag tag2("name", true, "condition");
|
||||
|
||||
EXPECT_FALSE(tag1 > tag2);
|
||||
EXPECT_FALSE(tag2 > tag1);
|
||||
|
||||
tag1 = Tag("name");
|
||||
tag2 = Tag("Name");
|
||||
|
||||
EXPECT_TRUE(tag1 > tag2);
|
||||
EXPECT_FALSE(tag2 > tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition");
|
||||
tag2 = Tag("name", true, "Condition");
|
||||
|
||||
EXPECT_TRUE(tag1 > tag2);
|
||||
EXPECT_FALSE(tag2 > tag1);
|
||||
|
||||
tag1 = Tag("name1");
|
||||
tag2 = Tag("name2");
|
||||
|
||||
EXPECT_FALSE(tag1 > tag2);
|
||||
EXPECT_TRUE(tag2 > tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition1");
|
||||
tag2 = Tag("name", true, "condition2");
|
||||
|
||||
EXPECT_FALSE(tag1 > tag2);
|
||||
EXPECT_TRUE(tag2 > tag1);
|
||||
|
||||
tag1 = Tag("name", true);
|
||||
tag2 = Tag("name", false);
|
||||
|
||||
EXPECT_FALSE(tag1 > tag2);
|
||||
EXPECT_TRUE(tag2 > tag1);
|
||||
}
|
||||
|
||||
TEST(Tag, lessThanOrEqualOperatorShouldReturnTrueIfTheFirstTagIsNotGreaterThanTheSecond) {
|
||||
Tag tag1("name", true, "condition");
|
||||
Tag tag2("name", true, "condition");
|
||||
|
||||
EXPECT_TRUE(tag1 <= tag2);
|
||||
EXPECT_TRUE(tag2 <= tag1);
|
||||
|
||||
tag1 = Tag("name");
|
||||
tag2 = Tag("Name");
|
||||
|
||||
EXPECT_FALSE(tag1 <= tag2);
|
||||
EXPECT_TRUE(tag2 <= tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition");
|
||||
tag2 = Tag("name", true, "Condition");
|
||||
|
||||
EXPECT_FALSE(tag1 <= tag2);
|
||||
EXPECT_TRUE(tag2 <= tag1);
|
||||
|
||||
tag1 = Tag("name1");
|
||||
tag2 = Tag("name2");
|
||||
|
||||
EXPECT_TRUE(tag1 <= tag2);
|
||||
EXPECT_FALSE(tag2 <= tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition1");
|
||||
tag2 = Tag("name", true, "condition2");
|
||||
|
||||
EXPECT_TRUE(tag1 <= tag2);
|
||||
EXPECT_FALSE(tag2 <= tag1);
|
||||
|
||||
tag1 = Tag("name", true);
|
||||
tag2 = Tag("name", false);
|
||||
|
||||
EXPECT_TRUE(tag1 <= tag2);
|
||||
EXPECT_FALSE(tag2 <= tag1);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Tag,
|
||||
greaterThanOrEqualToOperatorShouldReturnTrueIfTheFirstTagIsNotLessThanTheSecond) {
|
||||
Tag tag1("name", true, "condition");
|
||||
Tag tag2("name", true, "condition");
|
||||
|
||||
EXPECT_TRUE(tag1 >= tag2);
|
||||
EXPECT_TRUE(tag2 >= tag1);
|
||||
|
||||
tag1 = Tag("name");
|
||||
tag2 = Tag("Name");
|
||||
|
||||
EXPECT_TRUE(tag1 >= tag2);
|
||||
EXPECT_FALSE(tag2 >= tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition");
|
||||
tag2 = Tag("name", true, "Condition");
|
||||
|
||||
EXPECT_TRUE(tag1 >= tag2);
|
||||
EXPECT_FALSE(tag2 >= tag1);
|
||||
|
||||
tag1 = Tag("name1");
|
||||
tag2 = Tag("name2");
|
||||
|
||||
EXPECT_FALSE(tag1 >= tag2);
|
||||
EXPECT_TRUE(tag2 >= tag1);
|
||||
|
||||
tag1 = Tag("name", true, "condition1");
|
||||
tag2 = Tag("name", true, "condition2");
|
||||
|
||||
EXPECT_FALSE(tag1 >= tag2);
|
||||
EXPECT_TRUE(tag2 >= tag1);
|
||||
|
||||
tag1 = Tag("name", true);
|
||||
tag2 = Tag("name", false);
|
||||
|
||||
EXPECT_FALSE(tag1 >= tag2);
|
||||
EXPECT_TRUE(tag2 >= tag1);
|
||||
}
|
||||
|
||||
TEST(
|
||||
Tag,
|
||||
emittingAsYamlShouldOutputOnlyTheNameStringIfTheTagIsAnAdditionWithNoCondition) {
|
||||
|
||||
Reference in New Issue
Block a user