mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
!= operator for HostAndPort
This commit is contained in:
parent
fba685096f
commit
fadf89d824
@ -536,6 +536,21 @@ namespace BasicTests {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class HostAndPortTests {
|
||||
public:
|
||||
void run(){
|
||||
HostAndPort a( "x1" , 1000 );
|
||||
HostAndPort b( "x1" , 1000 );
|
||||
HostAndPort c( "x1" , 1001 );
|
||||
HostAndPort d( "x2" , 1000 );
|
||||
|
||||
ASSERT( a == b );
|
||||
ASSERT( a != c );
|
||||
ASSERT( a != d );
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class All : public Suite {
|
||||
public:
|
||||
@ -568,6 +583,8 @@ namespace BasicTests {
|
||||
add< QueueTest >();
|
||||
|
||||
add< StrTests >();
|
||||
|
||||
add< HostAndPortTests >();
|
||||
}
|
||||
} myall;
|
||||
|
||||
|
@ -61,6 +61,10 @@ namespace mongo {
|
||||
return _host == r._host && port() == r.port();
|
||||
}
|
||||
|
||||
bool operator!=(const HostAndPort& r) const {
|
||||
return _host != r._host || port() != r.port();
|
||||
}
|
||||
|
||||
/* returns true if the host/port combo identifies this process instance. */
|
||||
bool isSelf() const; // defined in message.cpp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user