mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Added equality operator to Location class.
This commit is contained in:
@@ -39,6 +39,10 @@ namespace loot {
|
||||
return boost::ilexicographical_compare(_url, rhs.URL());
|
||||
}
|
||||
|
||||
bool Location::operator == (const Location& rhs) const {
|
||||
return boost::iequals(_url, rhs.URL());
|
||||
}
|
||||
|
||||
std::string Location::URL() const {
|
||||
return _url;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace loot {
|
||||
Location(const std::string& url, const std::vector<std::string>& versions);
|
||||
|
||||
bool operator < (const Location& rhs) const;
|
||||
bool operator == (const Location& rhs) const;
|
||||
|
||||
std::string URL() const;
|
||||
std::vector<std::string> Versions() const;
|
||||
|
||||
@@ -48,6 +48,23 @@ TEST(Location, ConstructorsAndDataAccess) {
|
||||
}), loc.Versions());
|
||||
}
|
||||
|
||||
TEST(Location, EqualityOperator) {
|
||||
Location loc1, loc2;
|
||||
EXPECT_TRUE(loc1 == loc2);
|
||||
|
||||
loc1 = Location("http://www.example.com");
|
||||
loc2 = Location("HTTP://WWW.EXAMPLE.COM");
|
||||
EXPECT_TRUE(loc1 == loc2);
|
||||
|
||||
loc1 = Location("http://www.example.com", {"1.0"});
|
||||
loc2 = Location("http://www.example.com", {"1.1"});
|
||||
EXPECT_TRUE(loc1 == loc2);
|
||||
|
||||
loc1 = Location("http://www.example1.com");
|
||||
loc2 = Location("http://www.example2.com");
|
||||
EXPECT_FALSE(loc1 == loc2);
|
||||
}
|
||||
|
||||
TEST(Location, LessThanOperator) {
|
||||
Location loc1, loc2;
|
||||
EXPECT_FALSE(loc1 < loc2);
|
||||
|
||||
Reference in New Issue
Block a user